Blob Blame History Raw
#!/bin/sh
#
# prosody - Flexible communications server for Jabber/XMPP
#
# chkconfig: - 90 10
# description: Flexible communications server for Jabber/XMPP

# http://fedoraproject.org/wiki/FCNewInit/Initscripts
### BEGIN INIT INFO
# Provides: prosody
# Required-Start: network
# Required-Stop: network
# Default-Start: 
# Default-Stop: 0 1 6
# Short-Description: Start and stop prosody
# Description: 
### END INIT INFO

# Source function library.
. /etc/rc.d/init.d/functions

exec="/usr/bin/prosodyctl"
prog="prosody"
user="prosody"

[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog

lockfile=/var/lock/subsys/$prog

start() {
    echo -n $"Starting $prog: "
    daemon --user $user $exec start
    retval=$?
    echo
    [ $retval -eq 0 ] && touch $lockfile
    return $retval
}

stop() {
    echo -n $"Stopping $prog: "
    daemon $exec stop 2>/dev/null
    retval=$?
    echo
    [ $retval -eq 0 ] && rm -f $lockfile
    return $retval
}

restart() {
    stop
    start
}

case "$1" in
    start|stop|restart)
        $1
        ;;
    force-reload)
        restart
        ;;
    status)
        $exec status
        ;;
    try-restart|condrestart)
        if $exec status >/dev/null ; then
            restart
        fi
	;;
    reload)
        action $"Service ${0##*/} does not support the reload action: " /bin/false
        exit 3
        ;;
    *)
        echo $"Usage: $0 {start|stop|status|restart|try-restart|force-reload}"
        exit 2
esac