On 12/07/2013 02:18 AM, S. Dale Morrey wrote: > I've got a system I'm in charge of that uses a standard init script. i.e. > /etc/init.d/mydeamon start > > The problem is the daemon can randomly crash and because it's a signed > binary I can't just fix the problem and recompile. > > The thing MUST stay running. I was thinking about using a Nagios solution > but that seems like overkill. > > Is there someway to check if the process is running with cron? I was > thinking I could just do a restart once an hour, but it seems there should > just be a way to check the pid to see if it's running instead of a full > restart.
I've written my share of little bash "watch" scripts in my time. Just check for the process and if it's not running, start it. Now, though, I use supervisord. It's kind of like a lightweight, standalone LaunchDaemon, upstart, or systemd -style service (but it's *not* an init replacement!). You can write a little definition file that tells it how to start your daemon, and then it will automatically restart if it crashes. And you can check on the status and start and stop your daemon from the command line. http://supervisord.org/ /* PLUG: http://plug.org, #utah on irc.freenode.net Unsubscribe: http://plug.org/mailman/options/plug Don't fear the penguin. */
