akerbeltz you can create cron jobs to handle that, eg:
- Wrap your
daemonize
command in a shell script like ~/apps/appname/cron
, eg:
#!/bin/bash
daemonize -a -c /home/you/apps/appname \
-e /home/you/logs/apps/appname/stderr.log \
-o /home/you/logs/apps/appname/stdout.log \
-p /home/you/logs/apps/appname/pid
/home/you/apps/appname/however_you_start_it
- Create cron jobs to run your cron shell script like:
@reboot ~/apps/appname/cron > /dev/null
*/5 * * * * ~/apps/appname/cron > /dev/null
In the example above your cron script will run at reboot and every 5 minutes, which means your app would never be down for more than 5 minutes (unless it's actually broken).
If you need something more continuous then you could either schedule the cron job at a shorter interval, or use a process manager like supervisord
, pm2
, etc (instead of daemonize
) to keep it running continuously.