-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmulticastrd
More file actions
executable file
·51 lines (47 loc) · 852 Bytes
/
multicastrd
File metadata and controls
executable file
·51 lines (47 loc) · 852 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/bin/bash
unset PID
PIDFILE='/run/multicastrd.pid'
THEHOME='/home/mpesce/Dropbox/MooresCloud/demo/tol'
if [[ -r ${PIDFILE} ]]; then
read -r PID <"${PIDFILE}"
if [[ -n ${PID} && ! -d /proc/${PID} ]]; then
rm -f "${PIDFILE}"
unset PID
fi
fi
case "$1" in
start)
echo "Starting Multicastr Pipe Daemon"
if [[ -z ${PID} ]]
then
if [ -e '/run/multicastr.pipe' ]
then
rm /run/multicastr.pipe
fi
pushd .
cd $THEHOME
nohup python $THEHOME/multicastr.py >> /dev/null &
PID=$!
echo ":: multicastrd process "$PID
echo $PID > $PIDFILE
popd
else
exit 1
fi
;;
stop)
echo "Stopping Multicastr Pipe Daemon"
if [[ -n ${PID} ]] && kill "${PID}" &>/dev/null; then
rm ${PIDFILE}
else
exit 1
fi
;;
restart)
$0 stop
sleep 1
$0 start
;;
*)
echo "usage: $0 {start|stop|restart}"
esac