84 lines
2.0 KiB
Bash
84 lines
2.0 KiB
Bash
#!/bin/sh
|
|
#######################################################################
|
|
# Begin /etc/init.d/gpm
|
|
#
|
|
# Description : Start GPM Console Mouse Service
|
|
#
|
|
# Author : DJ Lucas - dj@linuxfromscratch.org
|
|
#
|
|
# Version : LFS 7.0
|
|
#
|
|
########################################################################
|
|
|
|
### BEGIN INIT INFO
|
|
# Provides: gpm
|
|
# Required-Start: $network $local_fs
|
|
# Should-Start:
|
|
# Required-Stop: $local_fs $network
|
|
# Should-Stop:
|
|
# Default-Start: 3 4 5
|
|
# Default-Stop: 0 1 2 6
|
|
# Short-Description: Starts and stops the GPM console mouse service.
|
|
# Description: Starts and stops the GPM console mouse service.
|
|
# X-LFS-Provided-By: BLFS / LFS 7.0
|
|
### END INIT INFO
|
|
|
|
. /lib/lsb/init-functions
|
|
|
|
#$LastChangedBy: bdubbs $
|
|
#$Date: 2012-03-23 21:43:45 -0500 (Fri, 23 Mar 2012) $
|
|
|
|
pidfile="/run/gpm.pid"
|
|
|
|
[ -f /etc/sysconfig/mouse ] && source /etc/sysconfig/mouse
|
|
|
|
case "${1}" in
|
|
start)
|
|
log_info_msg "Starting GPM console mouse service..."
|
|
if [ "${MDEVICE}" = "" -o "${PROTOCOL}" = "" ]; then
|
|
log_info_msg2 "invalid configuration"
|
|
log_failure_msg
|
|
exit 2
|
|
fi
|
|
start_daemon /usr/sbin/gpm -m "${MDEVICE}" -t "${PROTOCOL}" ${GPMOPTS}
|
|
evaluate_retval
|
|
;;
|
|
|
|
stop)
|
|
log_info_msg "Stopping GPM console mouse service..."
|
|
killproc /usr/sbin/gpm
|
|
evaluate_retval
|
|
;;
|
|
|
|
force-reload)
|
|
# gpm does not honor SIGHUP, restart if running
|
|
kill -0 `pidofproc -p "${pidfile}" /usr/sbin/gpm` 2>/dev/null
|
|
if [ "${?}" = "0" ]; then
|
|
${0} restart
|
|
else
|
|
log_info_msg "Force reloading GPM console mouse service..."
|
|
log_info_msg2 "not running"
|
|
log_failure_msg
|
|
fi
|
|
;;
|
|
|
|
restart)
|
|
${0} stop
|
|
sleep 1
|
|
${0} start
|
|
;;
|
|
|
|
status)
|
|
statusproc /usr/sbin/gpm
|
|
;;
|
|
|
|
*)
|
|
echo "Usage: ${0} {start|stop|force-reload|restart|status}"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
exit 0
|
|
|
|
# End /etc/init.d/gpm
|