]>
Commit | Line | Data |
---|---|---|
35f90335 AF |
1 | #!/bin/sh |
2 | ######################################################################## | |
3 | # Begin $rc_base/init.d/ | |
4 | # | |
5 | # Description : Client175 (MPD Client with Webinterface) | |
6 | # | |
7 | # Author : Arne Fitzenreiter | |
8 | # | |
9 | # Version : 01.00 | |
10 | # | |
11 | # Notes : for www.ipfire.org - GPLv3 | |
12 | # | |
13 | ######################################################################## | |
14 | ||
15 | . /etc/sysconfig/rc | |
16 | . ${rc_functions} | |
17 | ||
18 | case "$1" in | |
19 | start) | |
20 | if [ -e /var/run/client175.pid ]; then | |
21 | if ps -p $(cat /var/run/client175.pid) > /dev/null | |
22 | then | |
23 | boot_mesg "Client175 is already running." | |
24 | echo_failure | |
25 | exit 0 | |
26 | fi | |
27 | fi | |
28 | boot_mesg "Starting Client175 MPD WebIF..." | |
29 | sudo -u nobody python /srv/client175/server.py > /var/log/client175 2>&1 & | |
30 | echo $! > /var/run/client175.pid | |
31 | evaluate_retval | |
32 | ;; | |
33 | ||
34 | stop) | |
35 | if [ ! -e /var/run/client175.pid ]; then | |
36 | boot_mesg "Client175 pidfile not found!" | |
37 | echo_failure | |
38 | exit 0 | |
39 | fi | |
40 | boot_mesg "Stopping Client175 MPD WebIF..." | |
41 | kill $(cat /var/run/client175.pid) | |
42 | evaluate_retval | |
43 | rm -f /var/run/client175.pid | |
44 | ;; | |
45 | ||
46 | restart) | |
47 | ${0} stop | |
48 | sleep 1 | |
49 | ${0} start | |
50 | ||
51 | ;; | |
52 | status) | |
53 | if [ -e /var/run/client175.pid ]; then | |
54 | if ps -p $(cat /var/run/client175.pid) > /dev/null | |
55 | then | |
56 | ||
57 | boot_mesg "Client175 is running with Process Id(s) $(cat /var/run/client175.pid)" | |
58 | exit 0 | |
59 | fi | |
60 | fi | |
61 | boot_mesg "Client175 should not running" | |
62 | exit 0 | |
63 | ;; | |
64 | ||
65 | *) | |
66 | echo "Usage: ${0} {start|stop|reload|restart|status}" | |
67 | exit 1 | |
68 | ;; | |
69 | esac | |
70 | ||
71 | # End $rc_base/init.d/ |