0

I use debian, same service /usr/bin/something starts same daemon with different config file:

#!/bin/sh

# veriables
service1=on
service9=on
service45=on
[...]

/usr/bin/something /home/user/conf1/something
/usr/bin/something /home/user/conf9/something
/usr/bin/something /home/user/conf45/something

from command line I see with ps:

user 123 0.0 0.0 0.0 pts/2 /usr/bin/something /home/user/conf1/something
user 124 0.0 0.0 0.0 pts/2 /usr/bin/something /home/user/conf9/something
user 125 0.0 0.0 0.0 pts/2 /usr/bin/something /home/user/conf45/something

Sometimes linux kills one these and I need to automatically restart. These services really are less or more 100 but does not consecutive, so I need to check with ps which are not started and restart.

If os kills (e.g.)

user 123 0.0 0.0 0.0 pts/2 /usr/bin/something /home/user/conf1/something

the script should "scan" with ps which daemons are off - in this case it is

/home/user/conf1/something

only - and hence restart it.

  • 1
    You need to edit your question to tell answerers what operating system this is. Then they stand at least a chance of telling you how to use whatever service management your operating system provides. – JdeBP Sep 16 at 8:31
  • It would also be interesting to know what in "linux kills one of these" and for what reason. – MC68020 Sep 16 at 10:14
  • depends: sometime in dmesg I see "out of memory", although there's some free ram :-/ – Pol Hallen Sep 16 at 14:13

Your Answer

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

Browse other questions tagged or ask your own question.