You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
setproctitle.setproctitle modifies /proc/<pid>/cmdline as well as /proc/<pid>/status. I would like to modify what is seen via ps but retain what e.g. systemctl status shows.
This is what one gets without setproctitle:
user@demo:~$ cat /usr/local/bin/proctitle-demo
#!/usr/bin/python3
#import setproctitle
import sys
from time import sleep
#setproctitle.setproctitle(' '.join(sys.argv))
while True:
sleep(1)
user@demo:~$ systemctl status proctitle-demo
● proctitle-demo.service - proctitle-demo
Loaded: loaded (/etc/systemd/system/proctitle-demo.service; static; vendor preset: enabled)
Active: active (running) since Fri 2022-11-25 15:30:38 CET; 1min 12s ago
Main PID: 20802 (proctitle-demo)
Tasks: 1 (limit: 1149)
Memory: 2.8M
CGroup: /system.slice/proctitle-demo.service
└─20802 /usr/bin/python3 /usr/local/bin/proctitle-demo
user@demo:~$ ps aux | grep 20802 | grep -v grep
63158 20802 0.0 0.8 23040 8544 ? Ss 15:30 0:00 /usr/bin/python3 /usr/local/bin/proctitle-demo
This is what one gets with setproctitle:
user@demo:~$ sudo vim /usr/local/bin/proctitle-demo
user@demo:~$ cat /usr/local/bin/proctitle-demo
#!/usr/bin/python3
import setproctitle
import sys
from time import sleep
setproctitle.setproctitle(' '.join(sys.argv))
while True:
sleep(1)
user@demo:~$ sudo systemctl restart proctitle-demo
user@demo:~$ systemctl status proctitle-demo
● proctitle-demo.service - proctitle-demo
Loaded: loaded (/etc/systemd/system/proctitle-demo.service; static; vendor preset: enabled)
Active: active (running) since Fri 2022-11-25 15:32:39 CET; 2s ago
Main PID: 20879 (/usr/local/bin/)
Tasks: 1 (limit: 1149)
Memory: 2.8M
CGroup: /system.slice/proctitle-demo.service
└─20879 /usr/local/bin/proctitle-demo
user@demo:~$ ps aux | grep 20879 | grep -v grep
63158 20879 0.0 0.8 25104 8608 ? Ss 15:32 0:00 /usr/local/bin/proctitle-demo
user@demo:~$
The ps output as well as the CGroup tree has been modified as desired, but the Main PID line is unaesthetic.
The text was updated successfully, but these errors were encountered:
setproctitle.setproctitle
modifies/proc/<pid>/cmdline
as well as/proc/<pid>/status
. I would like to modify what is seen viaps
but retain what e.g.systemctl status
shows.This is what one gets without
setproctitle
:This is what one gets with
setproctitle
:The
ps
output as well as theCGroup
tree has been modified as desired, but theMain PID
line is unaesthetic.The text was updated successfully, but these errors were encountered: