Skip to content

Instantly share code, notes, and snippets.

@siavashs
Last active August 29, 2015 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siavashs/b7748b5ebf3b49288bf0 to your computer and use it in GitHub Desktop.
Save siavashs/b7748b5ebf3b49288bf0 to your computer and use it in GitHub Desktop.
remote_syslog2 rc.d script for FreeBSD
#!/bin/sh
#
# PROVIDE: remote_syslog
#
. /etc/rc.subr
name="remote_syslog"
rcvar="${name}_enable"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
load_rc_config $name
remote_syslog_start() {
if [ ! -f /var/run/$name.pid ]
then
if checkyesno ${rcvar}; then
echo -n "Starting services: $name"
/usr/local/bin/remote_syslog --pid-file=/var/run/$name.pid
echo "."
fi
else
echo "It appears $name is already running. NOT starting!"
fi
}
remote_syslog_stop() {
if [ ! -f /var/run/$name.pid ]
then
echo "It appears $name is not running."
else
echo -n "Stopping services: $name"
kill `cat /var/run/$name.pid`
rm /var/run/$name.pid
echo "."
fi
}
run_rc_command "$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment