Debian Codegraph @

config/init.d/redhat/shiny-server

raw symbols SCIP
1 #!/bin/shscip-shell filesystem . . `/bin/sh`.
2 #
3 # chkconfig: 2345 80 20
4 # description: shiny-server deploys R shiny applications
5 # processname: shiny-server
6
7 # Source function library.
8 . /etc/rc.d/init.d/functionsscip-shell source . . `/etc/rc.d/init.d/functions`.
9
10 prog=shiny-server
11 execute=$(whichscip-shell system . . which. $prog)
12 logfile="/var/log/${prog}.log"
13 lockfile="/var/run/${prog}.pid"
14
15 # Exit if the package is not installed
16 if [scip-shell system . . `[`. ! -x $execute ] ; then
17 echoscip-shell system . . echo. -n $"$prog wasn't found or isn't executable."
18 exit 1
19 fi
20
21 startscip-shell shell shell-project 0.0.0 start().() {
22 touchscip-shell system . . touch. $logfile
23 echoscip-shell system . . echo. -n $"Starting shiny-server: "
24 if [scip-shell system . . `[`. -e $lockfile ] && [scip-shell system . . `[`. -e /proc/`catscip-shell system . . cat. /var/run/shiny-server.pidscip-shell filesystem . . `/var/run/shiny-server.pid`.` ]; then
25 echoscip-shell system . . echo. -n $"already running.";
26 failure $"cannot start shiny-server: already running.";
27 echoscip-shell system . . echo.
28 return 1
29 fi
30 $prog --daemon "--pidfile=$lockfile" >> $logfile 2>&1 &
31 retval=$?
32 [scip-shell system . . `[`. $retval -eq 0 ] && success || failure
33 echoscip-shell system . . echo.
34 return $retval
35 }
36
37 stopscip-shell shell shell-project 0.0.0 stop().() {
38 echoscip-shell system . . echo. -n $"Stopping shiny-server: "
39 if [scip-shell system . . `[`. ! -e $lockfile ] || [scip-shell system . . `[`. ! -e /proc/`catscip-shell system . . cat. /var/run/shiny-server.pidscip-shell filesystem . . `/var/run/shiny-server.pid`.` ]; then
40 echoscip-shell system . . echo. -n $"not running.";
41 failure $"cannot stop shiny-server: not running.";
42 echoscip-shell system . . echo.
43 return 1
44 fi
45 killscip-shell system . . kill. `catscip-shell system . . cat. "$lockfile"`
46 retval=$?
47 [scip-shell system . . `[`. $retval -eq 0 ] && success || failure
48 echoscip-shell system . . echo.
49 return $retval
50 }
51
52 restartscip-shell shell shell-project 0.0.0 restart().() {
53 stopscip-shell shell shell-project 0.0.0 stop().
54 sleepscip-shell system . . sleep. 1
55 startscip-shell shell shell-project 0.0.0 start().
56 }
57
58 reloadscip-shell shell shell-project 0.0.0 reload().() {
59 echoscip-shell system . . echo. -n $"Reloading shiny-server: "
60 if [scip-shell system . . `[`. ! -e $lockfile ] || [scip-shell system . . `[`. ! -e /proc/`catscip-shell system . . cat. /var/run/shiny-server.pidscip-shell filesystem . . `/var/run/shiny-server.pid`.` ]; then
61 echoscip-shell system . . echo. -n $"not running.";
62 failure $"cannot reload shiny-server: not running.";
63 echoscip-shell system . . echo.
64 return 1
65 fi
66 killscip-shell system . . kill. -1 `catscip-shell system . . cat. "$lockfile"`
67 retval=$?
68 [scip-shell system . . `[`. $retval -eq 0 ] && success || failure
69 echoscip-shell system . . echo.
70 return $retval
71 }
72
73 rh_statusscip-shell shell shell-project 0.0.0 rh_status().() {
74 status $prog
75 }
76
77 rh_status_qscip-shell shell shell-project 0.0.0 rh_status_q().() {
78 rh_statusscip-shell shell shell-project 0.0.0 rh_status(). >/dev/nullscip-shell filesystem . . `/dev/null`. 2>&1
79 }
80
81 case "$1" in
82 start)
83 startscip-shell shell shell-project 0.0.0 start().
84 ;;
85 stop)
86 stopscip-shell shell shell-project 0.0.0 stop().
87 ;;
88 restart)
89 $1
90 ;;
91 reload)
92 $1
93 ;;
94 status)
95 rh_statusscip-shell shell shell-project 0.0.0 rh_status().
96 ;;
97 *)
98 echoscip-shell system . . echo. $"Usage: $0 {start|stop|status|restart}"
99 exit 2
100 esac