-
-
Save tlvince/1266098 to your computer and use it in GitHub Desktop.
znc init script for Arch Linux
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/bash | |
. /etc/rc.conf | |
. /etc/rc.d/functions | |
get_pid() { | |
pidof /usr/bin/znc | |
} | |
case "$1" in | |
start) | |
stat_busy "Starting znc" | |
PID=$(get_pid) | |
if [ -z "$PID" ]; then | |
su -s /bin/sh -c '/usr/bin/znc --datadir /etc/znc' 'znc' > /dev/null | |
if [ $? -gt 0 ]; then | |
stat_fail | |
exit 1 | |
else | |
add_daemon znc | |
stat_done | |
fi | |
else | |
stat_fail | |
exit 1 | |
fi | |
;; | |
stop) | |
stat_busy "Stopping znc" | |
PID=$(get_pid) | |
[ ! -z "$PID" ] && kill $PID | |
if [ $? -gt 0 ]; then | |
stat_fail | |
exit 1 | |
else | |
rm_daemon znc | |
stat_done | |
fi | |
;; | |
restart) | |
$0 stop | |
$0 start | |
;; | |
*) | |
echo "usage: $0 {start|stop|restart}" | |
esac | |
exit 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment