updated on Wed Jan 18 20:10:41 UTC 2012
[aur-mirror.git] / role / role.init
blobcb838588b003ef3bf44dc81c6b3956340a638cc9
1 #!/bin/bash
3 # general config
4 . /etc/rc.conf
5 . /etc/rc.d/functions
7 case "$1" in
8 start)
9 stat_busy "Starting ROLE"
10 cd /opt/role/db
11 su - role -c "cd db && java -Djetty.host=127.0.0.1 -Djetty.port=8073 -jar /opt/role/webapps/jetty-runner.jar --port 8073 /opt/role/webapps/role-uu-prototype.war --path /cam /opt/role/webapps/CamWebService.war --path /role /opt/role/ >> /var/log/role.log 2>&1" -s /bin/sh > /dev/null 2>&1 &
12 sleep 5
13 kill $!
14 sleep 5
15 echo `ps -fu role | awk 'NR != 1 {print $2}'` > /var/run/role.pid
16 if [ $? -gt 0 ]; then
17 stat_fail
18 else
19 add_daemon role
20 stat_done
23 stop)
24 stat_busy "Stopping ROLE"
25 cd /opt/role/db
26 [ -e /var/run/role.pid ] && PID=`cat /var/run/role.pid`
27 [ ! -z "$PID" ] && kill $PID &> /dev/null
28 if [ $? -gt 0 ]; then
29 stat_fail
30 else
31 rm_daemon role
32 rm -f /var/run/role.pid
33 stat_done
36 restart)
37 $0 stop
38 sleep 3
39 $0 start
42 echo "usage: $0 {start|stop|restart}"
43 esac