#!/bin/bash # # sonyvaoi This shell script enables the sony i/o programmable device # driver # # Author: Kevin J. Smith # # chkconfig: - 70 01 # # description: Enable sony device driver for controlling proprietary # sony vaio devices # processname: sonyvaio # # source function library . /etc/rc.d/init.d/functions pidfile=/tmp/sonypid.pid RETVAL=0 start() { echo -n $"Enabling Sony VAIO I/O programmable device driver" modprobe sonypi sonypid -D && success || failure RETVAL=$? echo `ps -ef | grep -v grep | grep "sonypid -D" | awk '{print $2}'` > $pidfile echo } stop() { echo -n $"Disabling Sony VAIO I/O programmable device driver" kill -SIGTERM `cat $pidfile` && success || failure RETVAL=$? rm $pidfile echo } restart() { stop start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; status) if [ -f $pidfile ]; then echo $"Sony VAIO I/O programmable device driver is enabled." RETVAL=0 else echo $"Sony VAIO I/O programmable device driver is disabled." RETVAL=3 fi ;; *) echo $"Usage: $0 {start|stop|status|restart}" exit 1 esac exit $RETVAL