Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- . /etc/rc.conf
- . /etc/rc.d/functions
- DAEMON=irssi
- USER=htpc
- PID=$(pidof -o %PPID $DAEMON)
- [ -r /etc/conf.d/irssi ] && . /etc/conf.d/irssi
- case "$1" in
- start)
- stat_busy "Starting $DAEMON Service"
- [ -z "$PID" ] && su $USER -c 'screen -dm -S '$DAEMON' -c ~/.irssi/screen_irssi' &> /dev/null
- if [ $? != 0 ]; then
- stat_fail
- else
- add_daemon $DAEMON
- stat_done
- fi
- ;;
- stop)
- stat_busy "Stopping $DAEMON Service"
- [ -n "$PID" ] && kill $PID &>/dev/null
- if [ $? != 0 ]; then
- stat_fail
- else
- rm_daemon $DAEMON
- stat_done
- fi
- ;;
- restart)
- $0 stop
- sleep 3
- $0 start
- ;;
- *)
- echo "usage: $0 {start|stop|restart}"
- esac
- exit 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement