我从中得到以下(截断的)输出--status-all
$ service --status-all
[..]
[ - ] ossec
[ - ] ossec-hids-authd
[..]
但我无法通过以下方式访问它service
:
$ service status ossec-hids-authd
status: unrecognized service
我的 init.d 脚本如下所示:
#!/bin/sh -e
#### BEGIN INIT INFO
# Provides: ossec-authd
# Required-Start: $network $local_fs $remote_fs
# Required-Stop: $network $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Authentication Daemon for OSSEC-HIDS.
# Description: Provides key signing for OSSEC Clients
### END INIT INFO
NAME=ossec-authd
DAEMON=/var/ossec/bin/ossec-authd
DAEMON_ARGS="-p 1515 2>&1 >> /var/ossec/logs/ossec-authd.log &"
PIDFILE=/var/run/ossec-authd.pid
test -x ${DAEMON} || exit 5
case $1 in
start)
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE $DAEMON "$NAME process" && status="0" || status="$?"
if [ $status = "0" ]; then
exit
fi
fi
log_daemon_msg "Starting the process" "$NAME"
if start-stop-daemon --start --quiet --oknodo --pidfile $PIDFILE --exec $DAEMON -- $DAEMON_ARGS; then
log_end_msg 0
else
log_end_msg 1
fi
;;
stop)
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE $DAEMON "Stoppping the $NAME process" && status="0" || status="$?"
if [ "$status" = 0 ]; then
start-stop-daemon --stop --quiet --oknodo --pidfile $PIDFILE
/bin/rm -rf $PIDFILE
fi
else
log_daemon_msg "$NAME process is not running"
log_end_msg 0
fi
;;
restart)
$0 stop && sleep 2 && $0 start
;;
status)
if [ -e $PIDFILE ]; then
status_of_proc -p $PIDFILE $DAEMON "$NAME process" && exit 0 || exit $?
else
log_daemon_msg "$NAME Process is not running"
log_end_msg 0
fi
;;
reload)
if [ -e $PIDFILE ]; then
start-stop-daemon --stop --signal USR1 --quiet --pidfile $PIDFILE --name $NAME -- $DAEMON_ARGS
log_success_msg "$NAME process reloaded successfully"
else
log_failure_msg "$PIDFILE does not exists"
fi
;;
*)
echo "Usage: $0 {start|stop|restart|reload|status}"
exit 2
;;
esac
我做错了什么?