updated on Thu Jan 19 20:01:47 UTC 2012
[aur-mirror.git] / kdeplasma-applet-switchy / vgad
blobd95ccb03ad989224206283c24b3dd9de021d6948
1 #!/bin/bash
3 daemon_name=vgad
5 . /etc/rc.conf
6 . /etc/rc.d/functions
8 get_pid() {
9 pidof -o %PPID $daemon_name
12 case "$1" in
13 start)
14 stat_busy "Starting $daemon_name daemon"
16 PID=$(get_pid)
17 if [ -z "$PID" ]; then
18 [ -f /var/run/$daemon_name.pid ] && rm -f /var/run/$daemon_name.pid
19 # RUN
20 $daemon_name &
22 if [ $? -gt 0 ]; then
23 stat_fail
24 exit 1
25 else
26 echo $(get_pid) > /var/run/$daemon_name.pid
27 add_daemon $daemon_name
28 stat_done
30 else
31 stat_fail
32 exit 1
36 stop)
37 stat_busy "Stopping $daemon_name daemon"
38 PID=$(get_pid)
39 # KILL
40 [ ! -z "$PID" ] && kill $PID &> /dev/null
42 if [ $? -gt 0 ]; then
43 stat_fail
44 exit 1
45 else
46 rm -f /var/run/$daemon_name.pid &> /dev/null
47 rm_daemon $daemon_name
48 stat_done
52 restart)
53 $0 stop
54 sleep 3
55 $0 start
58 status)
59 stat_busy "Checking $daemon_name status";
60 ck_status $daemon_name
64 echo "usage: $0 {start|stop|restart|status}"
65 esac
67 exit 0