Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
192 - 1
#!/bin/sh
2
#
3
# ossec-authd  Start the OSSEC-HIDS Authentication Daemon
4
#
5
# chkconfig: 2345 99 01
6
# description: Provides key signing for OSSEC Clients
7
# processname: ossec-authd
8
# config: /var/ossec/etc/ossec.conf
9
# pidfile: /var/run/ossec-authd.pid
10
### BEGIN INIT INFO
11
# Provides:          ossec-authd
12
# Required-Start:    $network $local_fs $remote_fs
13
# Required-Stop:     $network $local_fs $remote_fs
14
# Default-Start:     2 3 4 5
15
# Default-Stop:      0 1 6
16
# Short-Description: Authentication Daemon for OSSEC-HIDS.
17
# Description:       Provides key signing for OSSEC Clients
18
### END INIT INFO
19
 
20
# Author: Brad Lhotsky <brad.lhotsky@gmail.com>
21
# Author: Scott R. Shinn <scott@atomicorp.com>
22
 
23
NAME=ossec-authd
24
DAEMON=/var/ossec/bin/ossec-authd
25
PIDDIR=/var/ossec/var/run
26
SCRIPTNAME=/etc/init.d/ossec-authd
27
SYSTEMCTL_SKIP_REDIRECT=true
28
 
29
. /etc/rc.d/init.d/functions
30
if [ -f /etc/sysconfig/ossec-authd ]; then
31
        . /etc/sysconfig/ossec-authd
32
fi
33
 
34
 
35
getpid() {
36
    for filename in $PIDDIR/${NAME}*.pid; do
37
        pidfile=$(basename $filename)
38
        pid=$(echo $pidfile |cut -d\- -f 3 |cut -d\. -f 1)
39
        kill -0 $pid &> /dev/null
40
        RETVAL=$?
41
        if [ $RETVAL -eq 0 ]; then
42
            PIDFILE=$filename
43
            PID=$pid
44
        else
45
            rm -f $filename
46
        fi;
47
    done;
48
}
49
 
50
start() {
51
  echo -n $"Starting $NAME: "
52
  daemon $DAEMON $OPTIONS
53
  retval=$?
54
  if [ $retval -eq 0 ]; then
55
    echo_success
56
    echo
57
  else
58
    echo_failure
59
    echo
60
  fi
61
  return $retval
62
}
63
 
64
stop() {
65
  echo -n $"Stopping $NAME: "
66
  getpid
67
  killproc -p $PIDFILE $NAME
68
  retval=$?
69
  echo
70
  return $retval
71
}
72
 
73
restart() {
74
  stop
75
  start
76
}
77
 
78
case "$1" in
79
  start)
80
    start
81
    ;;
82
  stop)
83
    stop
84
    ;;
85
  status)
86
    getpid
87
    if [ -z $PIDFILE ]; then
88
        status $NAME
89
    else
90
        status -p $PIDFILE $NAME
91
    fi;
92
    ;;
93
  restart)
94
    restart
95
    ;;
96
  *)
97
    echo "Usage: $0 {start|stop|status}"
98
    exit 2
99
    ;;
100
esac
101