Translation update done using Pootle.
[gammu.git] / contrib / init / gammu-smsd.rh
blob11e4187288a11be9aed82e9388c6a5a3107fafd3
1 #! /bin/bash
3 # chkconfig: 345 65 35
4 # description: starts/stops Gammu
5 # written by Frank Vestergaard Pedersen <fvp@linuxhouse.dk>
8 ###################################################
9 # change these values to fit yur installation
10 user="gammu"
11 group="gammu"
12 bin="/usr/local/gammu/bin/gammu-smsd"
13 configfile="/etc/gammu-smsdrc"
14 pidfile="/var/run/gammu.pid"
16 ####################################################
17 # It should not be nesserry to edit below this line
18 ####################################################
20 proc_name=`basename $0`
21 PID=`cat $pidfile`
23 function START_CMD {
25 $bin -c $configfile -p $pidfile -U $user -G $group -d
26 if [ "$?" != "0" ];then
27 echo "ERROR - gammu did not start!"
31 function STATUS {
32 PID=`cat $pidfile`
33 if [ -n "$PID" ] ; then
34 echo "$proc_name running PID: $PID"
35 else
36 echo "$proc_name not running"
40 # See how we were called.
41 case "$1" in
42 start)
43 if [ -n "$PID" ]; then
44 if [ "`ps -p "$PID" -o comm=`" = "" ]; then
45 START_CMD
46 STATUS
47 else
48 echo "Error - $proc_name already running!"
49 STATUS
51 else
52 START_CMD
53 STATUS
56 status)
57 STATUS
60 stop)
61 if [ -n "$PID" ] ; then
62 echo "$proc_name stopping PID: $PID"
63 kill $PID
64 sleep 1
65 echo "" > $pidfile
66 echo "$proc_name stopped"
69 restart|reload)
70 $0 stop
71 $0 start
74 echo $"Usage: $0 {start|stop|restart|reload|status}"
75 exit 1
76 esac
78 exit 0