/[projects]/smsdaemon/scripts/smsdaemon-initscript
ViewVC logotype

Contents of /smsdaemon/scripts/smsdaemon-initscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 592 - (show annotations) (download)
Fri Feb 19 08:47:31 2010 UTC (14 years, 3 months ago) by torben
File size: 1009 byte(s)
be nicer to std::vector (we might save a expansion operation or two)
1 #! /bin/bash
2
3 PIDFILE="/var/run/smsdaemon.pid"
4 chmod 666 /dev/ttyUSB0
5
6
7 function start_d
8 {
9 /usr/local/bin/smsdaemon --daemon
10 }
11
12 function stop_d
13 {
14 if [ -f $PIDFILE ] ; then
15 PID=`cat $PIDFILE`
16 LINES=`ps aux | grep smsdaemon | grep $PID | wc -l`
17 if [ "$LINES" == "1" ] ; then
18 kill $PID
19 else
20 echo "pidfile found -- but smsdaemon not running"
21 fi
22 else
23 echo "PIDFILE not found !!!!!!!!"
24 fi
25 }
26
27 function status_d
28 {
29 if [ -f $PIDFILE ] ; then
30 PID=`cat $PIDFILE`
31 LINES=`ps aux | grep smsdaemon | grep $PID | wc -l`
32 if [ "$LINES" == "1" ] ; then
33 echo "smsdaemon running (pid=$PID)"
34 else
35 echo "pidfile found -- but smsdaemon not running"
36 fi
37 else
38 echo "no pidfile - smsdaemon not started"
39 fi
40 }
41
42 function reload_d
43 {
44 PID=`cat $PIDFILE`
45 kill -HUP $PID
46 }
47
48 case $1 in
49 "start")
50 start_d
51 ;;
52 "stop")
53 stop_d
54 ;;
55 "status")
56 status_d
57 ;;
58 "reload")
59 reload_d
60 ;;
61 "restart")
62 stop_d
63 sleep 5
64 start_d
65 ;;
66 *)
67 echo "Usage $0 [start|stop|status|reload|restart]"
68 ;;
69 esac

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20