How do I automatically start supervisor on boot in FreeBSD?
Is there a pre-existing startup script for supervisord
on FreeBSD? If not, is there a good guide for writing rc.d
scripts for FreeBSD? I'm pretty new to the platform.
Thanks.
UPDATE:
I now have the following in /usr/local/etc/rc.d/supervisord
, but it doesn't seem to be working. I'm not seeing anything in the startup scroll related to supervisord.
#!/bin/sh
# PROVIDE: supervisord
# REQUIRE: LOGIN
# KEYWORD: shutdown
. /etc/rc.subr
name="supervisord"
rcvar=`set_rcvar`
load_rc_config "$name"
command="/usr/local/bin/${name}"
command_args="-c /usr/local/etc/supervisord.conf"
supervisord_enable=${supervisord_enable-"NO"}
supervisord_pidfile=${supervisord_pidfile-"/var/run/supervisord.pid"}
pidfile="${supervisord_pidfile}"
run_rc_command "$1"
Solution 1:
If you installed supervisord from ports (sysutils/py-supervisor
) you should have a functioning rc script in /usr/local/etc/rc.d/supervisord
Check the script for info/other configuration parameters, but simply adding supervisord_enable="YES"
to /etc/rc.conf
should be all you need to do to make it start automatically on boot.
Solution 2:
If you installed supervisord from the port sysutils/py-supervisor
then this rc file is already present... (than to voretaq7 for pointing this out).
The basic framework of a rc file is:
#!/bin/sh
. /etc/rc.subr
name="supervisord"
rcvar=`set_rcvar`
load_rc_config "$name"
command="/usr/local/bin/${name}"
command_args=""
run_rc_command "$1"
Creating the file /usr/local/etc/rc.d/supervisord
with the above, then chmodding it +x
will get you started (probably).
I am assuming you have supervisord
installed in /usr/local/bin
, change that path as necessary. Also you can add any command line arguements you need (like a configuration file or whatever). I'm not familiar with supervisord, so I'm not sure what it needs.
Make sure you have a line in /etc/rc.conf
similar to supervisord_enable="YES"
or the script will do precisely nothing.