]> git.pld-linux.org Git - packages/airvideo.git/blob - airvideo.init
- old changes (2010-09-02)
[packages/airvideo.git] / airvideo.init
1 #!/bin/sh
2 #
3 # airvideo      Air-Video Video Streaming Server
4 #
5 # chkconfig:    345 20 80
6 #
7 # description:  Air-Video Video Streaming Server
8 #
9 # processname:  airvideo
10 # config:               /etc/airvideo.properties
11 # pidfile:              /var/run/airvideo.pid
12 #
13 # $Id$
14
15 # Source function library
16 . /etc/rc.d/init.d/functions
17
18 # Get network config
19 . /etc/sysconfig/network
20
21 # Check that networking is up.
22 if is_yes "${NETWORKING}"; then
23         if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
24                 msg_network_down "Air-Video Server"
25                 exit 1
26         fi
27 else
28         exit 0
29 fi
30
31 # Get service config - may override defaults
32 [ -f /etc/sysconfig/airvideo ] && . /etc/sysconfig/airvideo
33
34 start() {
35         # Check if the service is already running?
36         if [ -f /var/lock/subsys/airvideo ]; then
37                 msg_already_running "Air-Video Server"
38                 return
39         fi
40
41         msg_starting "Air-Video Server"
42         daemon --fork --chdir /var/lib/airvideo --pidfile /var/run/airvideo.pid --user nobody /usr/bin/java -jar /usr/share/java/AirVideoServerLinux.jar /etc/airvideo.properties
43         RETVAL=$?
44         if [ $RETVAL -eq 0 ]; then
45                 # XXX
46                 pgrep -u nobody java > /var/run/airvideo.pid
47                 touch /var/lock/subsys/airvideo
48         fi
49 }
50
51 stop() {
52         if [ ! -f /var/lock/subsys/airvideo ]; then
53                 msg_not_running "Air-Video Server"
54                 return
55         fi
56
57         # Stop daemons.
58         msg_stopping "Air-Video Server"
59         killproc --pidfile /var/run/airvideo.pid airvideo -TERM
60         rm -f /var/lock/subsys/airvideo
61 }
62
63 condrestart() {
64         if [ ! -f /var/lock/subsys/airvideo ]; then
65                 msg_not_running "Air-Video Server"
66                 RETVAL=$1
67                 return
68         fi
69
70         stop
71         start
72 }
73
74 RETVAL=0
75 # See how we were called.
76 case "$1" in
77   start)
78         start
79         ;;
80   stop)
81         stop
82         ;;
83   restart)
84         stop
85         start
86         ;;
87   try-restart)
88         condrestart 0
89         ;;
90   force-reload)
91         condrestart 7
92         ;;
93   status)
94         status --pidfile /var/run/airvideo.pid airvideo java
95         RETVAL=$?
96         ;;
97   *)
98         msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
99         exit 3
100 esac
101
102 exit $RETVAL
This page took 0.085918 seconds and 3 git commands to generate.