%PDF- %PDF-
Direktori : /data/old/etc/init.d/ |
Current File : //data/old/etc/init.d/esets |
#!/bin/sh # ### BEGIN INIT INFO # Provides: esets # Required-Start: $local_fs # Required-Stop: $local_fs # Should-Start: $syslog $network networking hal dbus # Should-Stop: $syslog $network networking hal dbus # X-Start-Before: x-display-manager gdm kdm xdm dm # X-Stop-After: x-display-manager gdm kdm xdm dm # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: ESET Security ### END INIT INFO # # chkconfig: 2345 30 80 # description: ESET Security # PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin DAEMON=/usr/sbin/esets_daemon [ -x "$DAEMON" ] || DAEMON=/opt/eset/esets/sbin/esets_daemon [ -x "$DAEMON" ] || DAEMON=/usr/local/sbin/esets_daemon [ -x "$DAEMON" ] || exit 0 [ -f "/proc/cmdline" ] && grep -q "esets=0" "/proc/cmdline" && exit 0 NAME=esets_daemon DESC="ESET Security" PIDFILE=/var/run/$NAME.pid ESETS_SERVICE="esets.service" ESETS_SYSTEMD_SERVICE="/lib/systemd/system/$ESETS_SERVICE" log_daemon_msg () { ESTART="$1"; } log_end_msg () { [ "$1" = 0 ] && log_success_msg "$ESTART" || log_failure_msg "$ESTART failed!"; } status () { pidofproc "$@" >/dev/null; } status_of_proc () { status "$1" "$2" "$3"; } if [ -f /etc/init.d/functions ]; then . /etc/init.d/functions log_daemon_msg () { echo -n "$1"; } log_end_msg () { [ "$1" = 0 ] && success || failure; echo; } elif [ -f /etc/rc.status ]; then . /etc/rc.status rc_reset log_daemon_msg () { echo -n "$1"; } log_end_msg () { [ "$1" = 0 ] && true || false; rc_status -v; } status () { echo -n "Checking for $DESC"; checkproc "$@"; rc_status -v; rc_exit; } elif [ -f /lib/lsb/init-functions ]; then . /lib/lsb/init-functions else log_success_msg () { echo "$@"; } log_failure_msg () { echo "$@"; } pidofproc () { if [ -e "$PIDFILE" ]; then read P < "$PIDFILE" if kill -0 "$P" 2>/dev/null; then echo $P return 0 else return 1 fi fi return 3 } fi locksubsys() { [ -d /var/lock/subsys ] && touch /var/lock/subsys/esets } unlocksubsys() { [ -d /var/lock/subsys ] && rm -f /var/lock/subsys/esets } if [ -e "$ESETS_SYSTEMD_SERVICE" ] ; then DESC="$DESC (via systemctl)" fi case "$1" in start) #/sbin/modprobe dazuko log_daemon_msg "Starting $DESC" "$NAME" if [ -e "$ESETS_SYSTEMD_SERVICE" ]; then systemctl "$1" "$ESETS_SERVICE" else P=`pidofproc -p $PIDFILE $DAEMON` if [ "$?" != "0" ]; then if ! $DAEMON; then log_end_msg 1 exit 1 fi locksubsys fi fi log_end_msg 0 ;; stop) log_daemon_msg "Stopping $DESC" "$NAME" if [ -e "$ESETS_SYSTEMD_SERVICE" ]; then systemctl "$1" "$ESETS_SERVICE" else P=`pidofproc -p $PIDFILE $DAEMON` if [ "$?" = "0" ]; then kill -TERM $P while kill -0 $P 2>/dev/null; do sleep 1; done unlocksubsys fi rm -f /var/run/esets_daemon.pid fi log_end_msg 0 ;; restart|force-reload) log_daemon_msg "Restarting $DESC" "$NAME" if [ -e "$ESETS_SYSTEMD_SERVICE" ]; then systemctl "$1" "$ESETS_SERVICE" else P=`pidofproc -p $PIDFILE $DAEMON` if [ "$?" = "0" ]; then kill -TERM $P while kill -0 $P 2>/dev/null; do sleep 1; done sleep 1 fi if ! $DAEMON; then log_end_msg 1 exit 1 fi locksubsys fi log_end_msg 0 ;; try-restart) if [ -e "$ESETS_SYSTEMD_SERVICE" ]; then systemctl "$1" "$ESETS_SERVICE" else P=`pidofproc -p $PIDFILE $DAEMON` [ "$?" = "0" ] && $0 restart || true fi ;; reload) log_daemon_msg "Reloading $DESC" "$NAME" if [ -e "$ESETS_SYSTEMD_SERVICE" ]; then systemctl "$1" "$ESETS_SERVICE" else P=`pidofproc -p $PIDFILE $DAEMON` if [ "$?" = "0" ]; then kill -HUP $P fi fi log_end_msg 0 ;; force-reload) if [ -e "$ESETS_SYSTEMD_SERVICE" ]; then systemctl "$1" "$ESETS_SERVICE" else log_daemon_msg "Force-reloading $DESC" "$NAME" P=`pidofproc -p $PIDFILE $DAEMON` if [ "$?" = "0" ]; then kill -USR1 $P fi fi log_end_msg 0 ;; status) if [ -e "$ESETS_SYSTEMD_SERVICE" ]; then systemctl "$1" "$ESETS_SERVICE" else status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" fi ;; *) echo "Usage: $0 {start|stop|restart|force-reload|reload}" >&2 exit 1 ;; esac