Php – Supervisor – how to get a program to run at intervals of time

bashPHPprocesssupervisord

Perhaps I'm misunderstanding with Supervisor does, but perhaps me asking this question will help clear that up. Basically, I have a Supervisor program in my /etc/supervisord.conf file that executes a bash script which simply executes a PHP script. I've been able to successfully get that bash script to run from supervisor only upon launch of supervisor. However, isn't the point of something like supervisor that it runs that tasks in the background at set intervals or something so that I can know it's always running and handling any tasks it might need to according to the script it runs?

Here is the program in my conf file:

[program:program_name_d]
command=/path/to/runme
process_name=%(program_name)s
numprocs=1
autostart=true

Best Answer

It sounds to me like what your actually looking for is closer to cron. I'm not familiar with supervisor but from the description provided here, it sounds it is trying to be a userspace replacement for certain aspects of init. By this I mean that it focuses in providing:

  • start/stop/restart of services(programs)
  • Automatic program crash detection and restart
  • Controlling the start order of various programs at boot.
  • Delegating management of services to the people who work with them (aka giving web server reboot-rights to the web devs).