Run on start up in FreeBSD
1.Crontab "@reboot"
...
0 2 * * 1 root /usr/local/bin/certbot renew --renew-hook "service apache24 restart" -q
#upnpc
* * * * * root /usr/local/bin/upnpc.sh
@reboot mosq:wheel /usr/local/bin/python3 /home/mosq/.workspace.py/python3/ilohas/ilohas/spider/batch/runner.py
2./etc/rc
add a line just before ending line.
...
/usr/local/bin/uwsgi --emperor /usr/local/etc/uwsgi/vassals --uid www --gid www --daemonize /var/log/uwsgi-emperor.log
exit 0
3.Create a script as System service.
path:/usr/local/etc/rc.d/
For a example
#!/bin/sh
# PROVIDE: miniupnpc
# REQUIRE: NETWORKING SERVERS DAEMON ldconfig resolv
# KEYWORD: shutdown
. /etc/rc.subr
# Add the following lines to /etc/rc.conf to enable miniupnpc
# miniupnpc_enable="YES"
# miniupnpc_config="port protocol [port2 protocol2] [...]"
name="miniupnpc"
rcvar=miniupnpc_enable
load_rc_config $name
miniupnpc_enable=${miniupnpc_enable:-"NO"}
command="/usr/local/bin/upnpc"
start_cmd="miniupnpc_start"
stop_cmd="miniupnpc_stop"
miniupnpc_start() {
eval "${command} -r ${miniupnpc_config} | grep duration"
}
miniupnpc_stop() {
echo "Remove redirections" ${miniupnpc_config}
eval ${command} -d ${miniupnpc_config} > /dev/null
}
run_rc_command "$1"
# eof
#!/bin/sh
#
#
# PROVIDE: ddclient
# REQUIRE: LOGIN
# KEYWORD: shutdown
#
# Add the following line to /etc/rc.conf to enable ddclient:
#
# ddclient_enable="YES"
#
# By default, ddclient does not daemonize. To launch ddclient
# as a daemon, add the -daemon 300 argument to ddclient_flags
#
. /etc/rc.subr
name="ddclient"
rcvar=ddclient_enable
command="/usr/local/sbin/${name}"
required_files="/usr/local/etc/${name}.conf"
load_rc_config ${name}
: ${ddclient_enable="NO"}
run_rc_command "$1"
add the following line to /etc/rc.conf.
xxx_enable="YES"
The End.
Comments
Post a Comment