updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / plptools / plptools.rcd
blob1f9be6cc1557157ea75e2751a205228611ca6a03
1 #!/bin/bash
3 # plptools Starts ncpd/plpfuse.
5 # chkconfig: 2345 45 10
6 # description: This facility enables connectivity to an EPOC PDA.
8 . /etc/rc.conf
9 . /etc/rc.d/functions
10 . /etc/conf.d/plptools
12 NCPD_PIDFILE=/var/run/plptools/ncpd.pid
13 NCPD_PID=$(cat $NCPD_PIDFILE 2>/dev/null)
14 if ! readlink -q /proc/$NCPD_PID/exe | grep -q '^/usr/sbin/ncpd'; then
15 NCPD_PID=
16 rm $NCPD_PIDFILE 2>/dev/null
19 PLPFUSE_PIDFILE=/var/run/plptools/plpfuse.pid
20 PLPFUSE_PID=$(cat $PLPFUSE_PIDFILE 2>/dev/null)
21 if ! readlink -q /proc/$PLPFUSE_PID/exe | grep -q '^/usr/sbin/plpfuse'; then
22 PLPFUSE_PID=
23 rm $PLPFUSE_PIDFILE 2>/dev/null
26 PLPPRINTD_PIDFILE=/var/run/plptools/plpprintd.pid
27 PLPPRINTD_PID=$(cat $PLPPRINTD_PIDFILE 2>/dev/null)
28 if ! readlink -q /proc/$PLPPRINTD_PID/exe | grep -q '^/usr/sbin/plpprintd'; then
29 PLPPRINTD_PID=
30 rm $PLPPRINTD_PIDFILE 2>/dev/null
33 start() {
34 echo "Starting EPOC support ..."
35 RETVAL=0
36 if [ ! -x /var/run/plptools ] ; then
37 install -m755 -d /var/run/plptools
39 if test "$START_NCPD" = "yes" ; then
40 stat_busy " ncpd: "
41 [[ -z $NCPD_PID ]] && /usr/sbin/ncpd $NCPD_ARGS
42 if [[ $? -gt 0 ]]; then
43 RETVAL=1
44 stat_fail
45 else
46 PID=`pidof -o %PPID /usr/sbin/ncpd`
47 echo $PID > $NCPD_PIDFILE 2>/dev/null
48 add_daemon ncpd
49 stat_done
52 if [ $RETVAL -eq 0 ] ; then
53 if test "$START_PLPFUSE" = "yes" ; then
54 stat_busy " plpfuse: "
55 [[ -z $PLPFUSE_PID ]] && /usr/sbin/plpfuse $PLPFUSE_ARGS $PLPFUSE_MOUNTPOINT
56 if [[ $? -gt 0 ]]; then
57 RETVAL=1
58 stat_fail
59 else
60 PID=`pidof -o %PPID /usr/sbin/plpfuse`
61 echo $PID > $PLPFUSE_PIDFILE 2>/dev/null
62 add_daemon plpfuse
63 stat_done
67 if [ $RETVAL -eq 0 ] ; then
68 if test "$START_PLPPRINTD" = "yes" ; then
69 stat_busy " plpprintd: "
70 [[ -z $PLPPRINTD_PID ]] && /usr/sbin/plpprintd $PLPPRINTD_ARGS
71 if [[ $? -gt 0 ]]; then
72 RETVAL=1
73 stat_fail
74 else
75 PID=`pidof -o %PPID /usr/sbin/plpprintd`
76 echo $PID > $PLPPRINTD_PIDFILE 2>/dev/null
77 add_daemon plpprintd
78 stat_done
82 [ $RETVAL -eq 0 ] && touch /var/lock/plptools
85 stop() {
86 echo "Stopping EPOC support ..."
87 RETVAL=0
88 if test "$START_PLPPRINTD" = "yes" ; then
89 stat_busy " plpprintd: "
90 [[ ! -z $PLPPRINTD_PID ]] && kill $PLPPRINTD_PID &> /dev/null
91 if [[ $? -gt 0 ]]; then
92 stat_fail
93 else
94 rm $PLPPRINTD_PIDFILE &>/dev/null
95 rm_daemon plpprintd
96 stat_done
99 if test "$START_PLPFUSE" = "yes" ; then
100 stat_busy " plpfuse: "
101 [[ ! -z $PLPFUSE_PID ]] && fusermount -u $PLPFUSE_MOUNTPOINT &> /dev/null
102 if [[ $? -gt 0 ]]; then
103 stat_fail
104 else
105 rm $PLPFUSE_PIDFILE &>/dev/null
106 rm_daemon plpfuse
107 stat_done
110 if test "$START_NCPD" = "yes" ; then
111 stat_busy " ncpd: "
112 [[ ! -z $NCPD_PID ]] && kill $NCPD_PID &> /dev/null
113 if [[ $? -gt 0 ]]; then
114 RETVAL=1
115 stat_fail
116 else
117 rm $NCPD_PIDFILE &>/dev/null
118 rm_daemon ncpd
119 stat_done
121 echo
123 [ $RETVAL -eq 0 ] && rm -f /var/lock/plptools
126 restart() {
127 stop
128 start
131 # See how we were called.
132 case "$1" in
133 start)
134 start
136 stop)
137 stop
139 status)
140 status ncpd
141 status plpprintd
143 restart|reload)
144 restart
146 condrestart)
147 test -f /var/lock/plptools && restart || :
150 echo "Usage: plptools {start|stop|status|restart|reload|condrestart}"
151 esac
152 exit 0