Login

How to rename processes

Author:
diverman
Posted:
October 23, 2011
Language:
Shell
Version:
1.3
Score:
1 (after 1 ratings)

Rename apache (or any) processes to be easily identified from ps output.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Consider following apache config:

WSGIDaemonProcess testwsgi display-name=wsgi_testproject user=testproject group=testproject processes=4 threads=1
WSGIDaemonProcess cache    display-name=cache_testproject  user=testproject group=testproject processes=1 threads=1

WSGIScriptAlias / /home/testproject/testwsgi.py process-group=testwsgi application-group=%{GLOBAL}
WSGIImportScript /home/testproject/runcache.py process-group=cache application-group=%{GLOBAL}


Rename apache2 binary:

$ mv /usr/sbin/apache2 /usr/sbin/apache2-bin

Create wrapper apache2 and make it executable:

$ vi /usr/sbin/apache2
#!/bin/bash
exec -a apache2_testproject /usr/sbin/apache2-bin $@

Done

$ ps faxu | grep testproject

root      3846  0.0  0.2  94252  4532 ?        Ss   13:21   0:00 apache2_testproject -k start
testproject  3854  0.0  0.3 120220  5780 ?        Sl   13:21   0:00  \_ wsgi_testproject    -k start
testproject  3855  0.0  0.3 120220  5760 ?        Sl   13:21   0:00  \_ wsgi_testproject    -k start
testproject  3856  0.0  0.3 120220  5760 ?        Sl   13:21   0:00  \_ wsgi_testproject    -k start
testproject  3857  0.0  0.3 120220  5760 ?        Sl   13:21   0:00  \_ wsgi_testproject    -k start
testproject  3858  0.0  0.3  96188  6584 ?        S    13:21   0:00  \_ cache_testproject   -k start
www-data  3859  0.0  0.1  93480  2864 ?        S    13:21   0:00  \_ apache2_testproject -k start
www-data  3860  0.0  0.3 319280  6268 ?        Sl   13:21   0:00  \_ apache2_testproject -k start
www-data  3861  0.0  0.3 319280  6280 ?        Sl   13:21   0:00  \_ apache2_testproject -k start

More like this

  1. the steps of migration using south in Django... by lockys 10 years, 2 months ago
  2. One line SMTP sink server by Baguage 10 years, 3 months ago
  3. Virtualfish Hook by HubertGrzeskowiak 10 years, 5 months ago
  4. Add CSRF token to templates by coleifer 13 years, 4 months ago

Comments

Please login first before commenting.