-
Notifications
You must be signed in to change notification settings - Fork 27
/
dionaeafr_init.sh
55 lines (50 loc) · 1.18 KB
/
dionaeafr_init.sh
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
52
53
54
#!/bin/bash
# DionaeaFR Startup script
# Koen Van Impe
. /lib/lsb/init-functions
#BASEDIR="/mnt/hgfs/www/camelot.cudeso.be/cudeso-honeypot/dionaea/DionaeaFR/DionaeaFR"
BASEDIR="/opt/DionaeaFR/DionaeaFR"
PIDFILE="/var/run/dionaeafr/dionaeafr.pid"
LOGFILE="/var/log/dionaeafr/dionaeafr.log"
NAME="dionaeafr"
DAEMON="dionaeafr"
PORT=8000
case $1 in
start)
cd $BASEDIR
python manage.py runserver 0.0.0.0:$PORT > $LOGFILE 2>> $LOGFILE &
log_daemon_msg "$DAEMON started ..."
log_end_msg 0
;;
stop)
if [ -e $PIDFILE ]; then
kill `cat $PIDFILE`
rm $PIDFILE
log_daemon_msg "$DAEMON stopped ..."
log_end_msg 0
else
log_daemon_msg "$DAEMON is *NOT* running"
log_end_msg 1
fi
;;
collectstatic)
cd $BASEDIR
python manage.py collectstatic
;;
logs)
cat $LOGFILE
;;
status)
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE $DAEMON "$NAME process" && exit 0 || exit $?
else
log_daemon_msg "$DAEMON is not running ..."
log_end_msg 0
fi
;;
*)
# For invalid arguments, print the usage message.
echo "Usage: $0 {start|stop|collectstatic|logs|status}"
exit 2
;;
esac