Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 24159f9426407b186c08364ce0db4792 > files > 3

xrdp-0.4.1-2mdv2010.0.i586.rpm

#!/bin/sh
#
# Startup script for xrdp
#
# chkconfig: 345 91 35
# description: Open source remote desktop protocol (RDP) server
# processname: xrdp
# pidfile: /var/run/xrdp.pid
# config: /etc/xrdp/xrdp.ini

### BEGIN INIT INFO
# Provides: xrdp
# Required-Start: $network
# Required-Stop: $network
# Should-Start: $named 
# Should-Stop: $named 
# Default-Start: 3 4 5
# Short-Description: Starts the xrdp daemon
# Description: Open source remote desktop protocol (RDP) server
### END INIT INFO

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

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

# source the xrdp configuration
[ -f /etc/sysconfig/xrdp ] && . /etc/sysconfig/xrdp

RETVAL=0

start() {
	gprintf "Starting xrdp and sasman: "
	cd /usr/lib/xrdp

	if [ -n "`/sbin/pidof xrdp`" ]; then
            gprintf "xrdp: already running\n"
	    echo
            return 1
        fi
	daemon xrdp ${XRDP_OPTIONS} >&/dev/null
	RETVAL=$?
	[ "`pidof xrdp`" -ne "0" ] && success || failure

	if [ -n "`/sbin/pidof sesman`" ]; then
            gprintf "sesman: already running\n"
	    echo
            return 1
        fi
	daemon sesman ${SESMAN_OPTIONS} >&/dev/null
	[ "`pidof sesman`" -ne "0" ] && success || failure

	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/xrdp
	return $RETVAL
}

stop() {
	gprintf "Shutting down xrdp and sasman: "
	cd /usr/lib/xrdp

	xrdp --kill >&/dev/null
	[ "`pidof xrdp`" == "0" ] && failure || success

	sesman --kill >&/dev/null
	[ "`pidof sesman`" == "0" ] && failure || success

	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/xrdp /var/run/xrdp.pid
	return $RETVAL
}

restart() {
	stop
	start
}

case "$1" in
  start)
	start
	;;
  stop)
	stop
	;;
  restart|reload)
	restart
	;;
  condrestart)
	[ -e /var/lock/subsys/xrdp ] && restart
	RETVAL=$?
	;;
  status)
	status xrdp
	status sesman
	RETVAL=$?
	;;
  *)
	gprintf "Usage: %s {start|stop|restart|reload|condrestart|status}\n" "$0"
	RETVAL=1
esac

exit $RETVAL