-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathcowrie
More file actions
54 lines (48 loc) · 1.26 KB
/
cowrie
File metadata and controls
54 lines (48 loc) · 1.26 KB
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/sh
### BEGIN INIT INFO
# Provides: cowrie
# Required-Start: $syslog
# Required-Stop: $syslog
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Cowrie SSH Honeypot
### END INIT INFO
set -e
COWRIE="/home/cowrie/cowrie/bin/cowrie"
test -x ${COWRIE} || exit 0
. /lib/lsb/init-functions
case "$1" in
start)
log_daemon_msg "Starting Cowrie Honeypot"
if sudo -u cowrie start-stop-daemon --start --quiet --oknodo --pidfile /var/run/cowrie.pid --exec ${COWRIE} start; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
stop)
log_daemon_msg "Stopping Cowrie Honeypot"
${COWRIE} stop
if start-stop-daemon --stop --quiet --oknodo --pidfile /var/run/cowrie.pid ; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
restart)
log_daemon_msg "Retarting Cowrie Honeypot"
${COWRIE} stop
start-stop-daemon --stop --quiet --oknodo --retry 30 --pidfile /var/run/cowrie.pid
check_for_non_start log_end_msg
check_dev_null log_end_msg
if start-stop-daemon --start --quiet --oknodo --pidfile /var/run/cowrie.pid --exec ${COWRIE} start; then
log_end_msg 0 || true
else
log_end_msg 1 || true
fi
;;
*)
log_action_msg "Usage: /etc/init.d/cowrie {start|stop|restart}" || true
exit 1
esac
exit 0