updated on Thu Jan 26 16:09:46 UTC 2012
[aur-mirror.git] / diaspora-git / diaspora.rc
blob8464f3947e38085bc22cb7cc6bd2c4ff59426927
1 #!/bin/bash
3 daemon_name=diaspora
4 dusr=diaspora
6 . /etc/rc.conf
7 . /etc/rc.d/functions
9 PID=`pgrep -u $daemon_name`
11 case "$1" in
12 start)
13 #Check if db and redis are running, start them if not
14 ck_daemon -DB- && /etc/rc.d/-DB- start
15 ck_daemon redis && /etc/rc.d/redis start
17 if [ ! -e /var/log/$daemon_name.log ]; then
18 touch /var/log/$daemon_name.log
19 chown $dusr:$dusr /var/log/$daemon_name.log
22 stat_busy "Starting $daemon_name daemon"
23 [ -z "$PID" ] && /bin/su - $dusr -c "/usr/bin/$daemon_name &"
24 if [ $? -gt 0 ]; then
25 stat_fail
26 exit 1
27 else
28 add_daemon $daemon_name
29 stat_done
33 stop)
34 stat_busy "Stopping $daemon_name daemon"
35 kill $PID &>/dev/null
36 if [ $? -gt 0 ]; then
37 stat_fail
38 exit 1
39 else
40 while [ ! -z "$(pgrep -u $daemon_name)" ]; do
41 sleep 1;
42 done
43 rm_daemon $daemon_name
44 stat_done
48 restart)
49 $0 stop
50 sleep 3
51 $0 start
54 status)
55 stat_busy "Checking $daemon_name status"
56 ck_status $daemon_name
60 echo "usage: $0 {start|stop|restart|status}"
61 esac
63 exit 0
65 # vim: syntax=sh