1

I ran ps aux --forest -j to see parent and child processes. Here is an example:

root      3744  3744  3744  0.0  0.2  77084  4160 ?        Ss   09:34   0:00 /usr/sbin/cupsd -f
lp        3747  3747  3744  0.0  0.1  63156  2236 ?        S    09:34   0:00  \_ /usr/lib/cups/notifier/dbus dbus:// 
lp        3748  3748  3744  0.0  0.1  63156  2240 ?        S    09:34   0:00  \_ /usr/lib/cups/notifier/dbus dbus:// 

In the third column is the PGID. My goal is to kill all 3 of these PIDs by using the PGID of the parent, 3744. My command is -

pkill -TERM -g 3744

This works, however, the process respawns itself with new PIDs. How can I avoid this and make it persistent?

  • There's probably a service manager that is restarting cups when it dies. What is the output of service cups status ? – Mark Plotnick Aug 7 '15 at 19:43
  • sudo service cups status cups start/running, process 3844 – user53029 Aug 7 '15 at 20:58
  • I guess its safe to say if its backed a service or script that runs every so often the only way to make it persistent is to disable the service? Or remove it from the script? – user53029 Aug 7 '15 at 21:01
  • You have a couple choices here. Is your goal to kill off the cups server and to not have it restarted ever? Restarted at the next reboot? Restarted only upon an explicit service start or equivalent command? – Mark Plotnick Aug 7 '15 at 21:03
  • Since service handling is not quite standardized, the best solution may differ slightly depending on your distribution. Can you add your distribution and its release number, such as ubuntu 15.04? – Mark Plotnick Aug 7 '15 at 21:06
2

You're running Ubuntu 14.04, which uses upstart as its init process. As we can see from looking at /etc/init/cups.conf, it has a respawn stanza, so by default when the cupsd process ends, another one will be started.

# kill -TERM -3390
# tail -1 /var/log/syslog
Aug  9 14:22:49 ubuntu kernel: [  283.270126] init: cups main process ended, respawning

You said you wanted the cupsd process tree killed, and restarted at the next reboot. To do this, you can use the initctl stop (or just stop) command:

# stop cups
cups stop/waiting

You may also want to stop cups-browsed, if you want all things associated with cups to stop.

This won't permanently disable the service. Upon reboot, the cups processes will be started.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.