Rev 1395 | Rev 1476 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log
Rev | Author | Line No. | Line |
---|---|---|---|
807 | franck | 1 | #!/bin/sh |
825 | franck | 2 | # $Id: alcasar-daemon.sh 1474 2014-11-03 22:55:09Z richard $ |
807 | franck | 3 | |
824 | franck | 4 | # alcasar-daemon.sh |
1474 | richard | 5 | # by Franck BOUIJOUX & Rexy |
807 | franck | 6 | # This script is distributed under the Gnu General Public License (GPL) |
7 | # Watchdog of Services |
||
8 | # See /etc/cron.d/alcasar-daemon-watchdog for config the time |
||
9 | |||
824 | franck | 10 | conf_file="/usr/local/etc/alcasar.conf" |
11 | SSH=`grep SSH= $conf_file|cut -d"=" -f2` # sshd active (on/off) |
||
12 | SSH=${SSH:=off} |
||
1474 | richard | 13 | SERVICES="mysqld httpd ntpd iptables dnsmasq dnsmasq-blacklist dnsmasq-whitelist dnsmasq-blackhole radiusd nfsen dansguardian freshclam ulogd-ssh ulogd-traceability ulogd-ext-access chilli fail2ban sshd" |
807 | franck | 14 | |
824 | franck | 15 | function ServiceTest () { |
16 | CMD=`pidof $s` |
||
17 | if [ -z "$CMD" ] |
||
18 | then |
||
1474 | richard | 19 | systemctl start $s.service |
824 | franck | 20 | fi |
21 | } |
||
807 | franck | 22 | |
824 | franck | 23 | |
1474 | richard | 24 | for s in $SERVICES |
807 | franck | 25 | do |
824 | franck | 26 | if [ $s != "sshd" ] |
807 | franck | 27 | then |
1018 | franck | 28 | ServiceTest |
824 | franck | 29 | else |
30 | { |
||
31 | if [ $SSH == "ON" ] | [ $SSH == "on" ] | [ $SSH == "On" ] |
||
32 | then |
||
1018 | franck | 33 | ServiceTest |
824 | franck | 34 | fi |
35 | } |
||
807 | franck | 36 | fi |
37 | done |