summaryrefslogtreecommitdiff
path: root/pcr/psad/psad-sysvinit.archlinux
blob: 6b4e76042a07338ed651b4facfcacc4875912a02 (plain)
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
#!/bin/bash
#
# Startup script for psad
#
# chkconfig: 345 99 05
# description: The Port Scan Attack Detector (psad)
# processname: psad
# pidfile: /var/run/psad.pid
# config: /etc/psad/psad.conf
#
# $Id: psad-init.archlinux

. /etc/rc.conf
. /etc/rc.d/functions
. /etc/conf.d/sshd

PID=`cat /var/run/psad.pid`
# See how we were called.
case "$1" in
start)
    stat_busy "Starting psad"
    [ -z "$PID" ] && /usr/sbin/psad
    if [ $? -gt 0 ]; then
      stat_fail
    else
      #let psad take care of the pid; we don't need to
      add_daemon psad
      stat_done
    fi
    ;;
stop)
    stat_busy "Stopping psad"
    /usr/sbin/psad --Kill
    if [ $? -gt 0 ]; then
      stat_fail
    else
      #let psad take care of the pid; we don't need to
      rm_daemon psad
      stat_done
    fi
    ;;
status)
    /usr/sbin/psad --Status
    ;;
restart)
    $0 stop
    $0 start
    ;;
*)
    echo "Usage: psad {start|stop|status|restart}"
    exit 1
esac