#!/bin/sh
# Author: Holger Macht <hmacht@suse.de>
#
# /etc/init.d/rcconsolekit
#
### BEGIN INIT INFO
# Provides:          consolekit
# Required-Start:    boot.localnet dbus 
# Should-Start:
# Required-Stop:     
# Should-Stop:
# Default-Start:     2 3 5
# Default-Stop:      
# Short-Description: System daemon for tracking users, sessions and seats
# Description:       ConsoleKit is a system daemon for tracking what users are logged
#                    into the system and how they interact with the computer (e.g.
#                    which keyboard and mouse they use).
#                    
### END INIT INFO

# Check for binary
CK_BIN=/usr/sbin/console-kit-daemon
test -x $CK_BIN || exit 5

CK_PID=`pidof $CK_BIN`

. /etc/rc.status

# Reset status of this service
rc_reset

case "$1" in
    start)
	if [ -n "$CK_PID" ]; then
	    echo "ConsoleKit already running"
	    exit 0
	fi

	echo -n "Starting ConsoleKit"
	startproc $CK_BIN
	rc_status -v
        ;;
    stop)
	if [ -z "$CK_PID" ]; then
	    echo "ConsoleKit not running"
	    exit 0
	fi

	echo -n "Shutting down ConsoleKit"
       	killproc -p $CK_PID -TERM $CK_BIN
       	rc_status -v
        ;;
    restart)
        $0 stop
        $0 start
        ;;
    status)
        echo -n "Checking for service ConsoleKit daemon"
        checkproc $CK_BIN
        rc_status -v
        ;;
    *)
        echo "Usage: $0 {start|stop|status}"
        exit 1
        ;;
esac
rc_exit


