aboutsummaryrefslogtreecommitdiff
path: root/system/epson-printer-utility/rc.ecbd
blob: c534fab9aa89eb31da79cb130c094bd6f251d2a6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
#script to start/stop etc epson communication backend daemon ecbd

if [ ! -x /usr/lib/epson-backend/ecbd ]; then
  echo "/usr/lib/epson-backend/ecbd not executable"
  exit 1
fi
PIDFILE=/var/run/ecbd.pid
OPT=${1:-start}
case "$OPT" in
'start')
  if [ `ps -A|grep ecbd|grep -v "rc.ecbd"|wc -l` -gt 0 ]||[ -e $PIDFILE ]; then
    echo "ecbd is already running"
  else
    /usr/lib/epson-backend/ecbd -p $PIDFILE &
  fi
  ;;
'stop')
  if [ -e /var/run/ecbd.pid ]; then
    kill `cat $PIDFILE`
  fi
  rm -f $PIDFILE
  ;;
'restart')
  if [ -e $PIDFILE ]; then
    kill `cat $PIDFILE`
  fi
  rm -f $PIDFILE
  /usr/lib/epson-backend/ecbd -p $PIDFILE &
  ;;
*)
  echo "usage $0 start|stop|restart"
esac