Created
December 4, 2017 01:41
-
-
Save digizeph/d1f8eb868b7193e1b0341f0cd52f8ba7 to your computer and use it in GitHub Desktop.
Simple template for freebsd rc script
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| . /etc/rc.subr | |
| name=gobgp | |
| rcvar=gobgp_enable | |
| start_cmd="${name}_start" | |
| stop_cmd="${name}_stop" | |
| stop_postcmd="${name}_cleanup" | |
| pidfile=/var/run/gobgp.pid | |
| load_rc_config $name | |
| : ${gobgp_enable:=no} | |
| : ${gobgp_msg="Nothing started."} | |
| gobgp_start() | |
| { | |
| echo "Starting GOBGP" | |
| touch ${pidfile} | |
| /usr/sbin/daemon -cf -p ${pidfile} /usr/local/bin/gobgp | |
| } | |
| gobgp_stop() | |
| { | |
| echo "Stopping GOBGP" | |
| pkill $name | |
| } | |
| gobgp_cleanup() { | |
| [ -f ${pidfile} ] && rm ${pidfile} | |
| } | |
| run_rc_command "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment