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

Annotation of /smsdaemon/scripts/smsdaemon-initscript

Parent Directory Parent Directory | Revision Log Revision Log


Revision 592 - (hide 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 torben 204 #! /bin/bash
2 torben 170
3     PIDFILE="/var/run/smsdaemon.pid"
4 torben 592 chmod 666 /dev/ttyUSB0
5 torben 170
6 torben 592
7 torben 204 function start_d
8     {
9 torben 520 /usr/local/bin/smsdaemon --daemon
10 torben 170 }
11    
12 torben 204 function stop_d
13 torben 170 {
14 torben 204 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 torben 170 else
20 torben 204 echo "pidfile found -- but smsdaemon not running"
21 torben 170 fi
22 torben 204 else
23     echo "PIDFILE not found !!!!!!!!"
24     fi
25 torben 170 }
26    
27 torben 204 function status_d
28 torben 170 {
29 torben 204 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 torben 170 fi
37 torben 204 else
38     echo "no pidfile - smsdaemon not started"
39 torben 170 fi
40     }
41    
42 torben 208 function reload_d
43     {
44     PID=`cat $PIDFILE`
45     kill -HUP $PID
46     }
47    
48 torben 204 case $1 in
49     "start")
50     start_d
51     ;;
52     "stop")
53     stop_d
54     ;;
55     "status")
56     status_d
57     ;;
58 torben 208 "reload")
59     reload_d
60     ;;
61 torben 209 "restart")
62     stop_d
63     sleep 5
64     start_d
65     ;;
66 torben 170 *)
67 torben 209 echo "Usage $0 [start|stop|status|reload|restart]"
68 torben 204 ;;
69 torben 170 esac

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.20