Bash Script - How do I make sure my program is still running?
Hello,
I have minimal(almost no) experience with linux and have ssh to a server with minimal access. My objective is to keep a program running. If the server shuts down then it will stop. I want to make sure it stays live. I would appreciate any help with this. Just a note: I don't really know anything about cron jobs, just that they exist. Would this be a solution? Thanks, Mike |
I think I remember to have used 'nohup <command> &'. This should run the command independent from the existence of the console you used to start it.
|
How do I stop a command like that?
|
You need to know the process ID (e.g. ps ax | grep <command>). Then you can send the stop signal with e.g. 'kill -19 <pid>'. -19 is equivalent to SIGSTOP, but there are many others (see 'kill -l'). I don't know which is to prefer.
|
An even easier way to get the process ID (PID) of your program is to do
Code:
ps -C [program name] Code:
fg [command name] |
All times are GMT -5. The time now is 01:59 AM. |