LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Show list of running tasks from services / init.d in Debian / Ubuntu? (https://www.linuxquestions.org/questions/linux-general-1/show-list-of-running-tasks-from-services-init-d-in-debian-ubuntu-699132/)

browny_amiga 01-22-2009 09:36 AM

Show list of running tasks from services / init.d in Debian / Ubuntu?
 
Hi there

I am currently creating a powersave program that is pretty simple:

Make a list of services / init.d "services" that are running, shut them down via init.d scripts (the proper way) for power save and then (since the list was saved) restart them later again.

I have tried this out and there is a lot of watts to save.

But how can I figure out which init.d services are running currently?
most init.d scripts under Debian / Ubuntu don't offer a status function (running / not running)

Is there a standardized way these services and servers log themselved in some directory so that I can know that they are running?

I can of course see a list of them running with ps, but not from which init.d script they originated.

Cheers

Markus

blackhole54 01-23-2009 05:00 AM

This isn't foolproof, but you may be able to adapt it to your needs ... A lot of services will write a /var/run/*.pid file. In many case the asterisk (*) will be the name of the file in /etc/init.d. Sadly, this is not always the case.


All times are GMT -5. The time now is 04:14 AM.