-
-
Save ckoepp/52f6f0262de04cee1b88ef4a441e276d to your computer and use it in GitHub Desktop.
FreeBSD rc.d script for isso
This file contains 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 | |
# | |
# PROVIDE: isso | |
# REQUIRE: networking | |
# KEYWORD: shutdown | |
# | |
# Add the following lines to /etc/rc.conf to enable isso: | |
# | |
# isso_enable (bool): Set to "NO" by default. | |
# Set it to "YES" to enable isso. | |
# | |
# isso_config_path (str): Set to "/etc/isso.conf" by default. | |
# | |
# isso_bin_path (str): Set to "/usr/local/bin/isso" by default. | |
# | |
# isso_run_user (str): Set to "www" by default. | |
# Defines the user that isso will run on | |
# | |
. /etc/rc.subr | |
name="isso" | |
rcvar="${name}_enable" | |
load_rc_config $name | |
: ${isso_enable:=no} | |
: ${isso_config_path="/etc/isso.conf"} | |
: ${isso_config_path="/usr/local/bin/isso"} | |
: ${isso_run_user="www"} | |
pidfile="/var/run/isso.pid" | |
command="${isso_bin_path} -c ${isso_config_path}" | |
start_cmd="isso_start" | |
status_cmd="isso_status" | |
stop_cmd="isso_stop" | |
isso_start() { | |
echo "Starting ${name}..." | |
/usr/sbin/daemon -c -u ${isso_run_user} -p ${pidfile} ${command} | |
} | |
isso_status() { | |
if [ -f ${pidfile} ]; then | |
echo "${name} is running as $(cat $pidfile)." | |
else | |
echo "${name} is not running." | |
return 1 | |
fi | |
} | |
isso_stop() { | |
if [ ! -f ${pidfile} ]; then | |
echo "${name} is not running." | |
return 1 | |
fi | |
echo -n "Stopping ${name}..." | |
kill -KILL $(cat $pidfile) 2> /dev/null && echo "stopped" | |
rm -f ${pidfile} | |
} | |
run_rc_command "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey! 👋 Thanks for this! A tiny issue though, Line 29, should state
so, $isso_bin_path instead of a second $isso_config_path.
Also note that FreeBSD assumes locally installed third-party software and their configuration below
/usr/local…
, so I changed the default$isso_config_path
to/usr/local/etc/isso.conf