updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / smstools3 / smsd.rc
blob76252ceaa6256250508dfe668017fad41fb091d5
1 #!/bin/bash
3 if [ "$(whoami)" != "root" ]; then
4 echo "You must be root to start/restart/stop services."
5 exit 1
6 fi
8 . /etc/rc.conf
9 . /etc/rc.d/functions
11 DESC="SMS Server Tools 3"
13 PARAMS=""
14 USER="smsd"
15 GROUP="smsd"
16 PIDFILE="/var/run/smsd/smsd.pid"
17 INFOFILE="/var/run/smsd/smsd.working"
18 LOGFILE="/var/log/smsd/smsd.log"
20 [ -r "/etc/conf.d/smsd" ] && . /etc/conf.d/smsd
22 PID=`cat $PIDFILE 2>/dev/null`
24 case "$1" in
25 start)
26 stat_busy "Starting $DESC"
27 [ -n "$USER" ] && PARAMS="-u$USER $PARAMS"
28 [ -n "$GROUP" ] && PARAMS="-g$GROUP $PARAMS"
29 [ -n "$LOGFILE" ] && PARAMS="-l$LOGFILE $PARAMS"
30 if [ -z "$PID" ]; then
31 /usr/bin/smsd -n MAINPROCESS -p$PIDFILE -i$INFOFILE $PARAMS
32 sleep 1
33 PID=`cat $PIDFILE 2>/dev/null`
34 if [ -z "$PID" ]; then exit 1; fi
35 add_daemon smsd
36 stat_done
37 else
38 echo -n "Already running!"
39 stat_fail
42 stop)
43 stat_busy "Stopping $DESC"
44 [ -n "$PID" ] && kill $PID &>/dev/null
45 if [ $? -gt 0 ]; then
46 echo -n "Not started!"
47 stat_fail
48 else
49 rm_daemon smsd
50 stat_done
53 restart)
54 $0 stop
55 $0 start
58 echo "usage: $0 {start|stop|restart}"
59 esac