Add configuration directory, move configuration files to new directory
This commit is contained in:
parent
903d594079
commit
1e5a776839
74
check_clamav-daemon.sh
Executable file
74
check_clamav-daemon.sh
Executable file
@ -0,0 +1,74 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
tmp_err_msg=$(mktemp)
|
||||||
|
|
||||||
|
# - Is this a systemd system?
|
||||||
|
# -
|
||||||
|
if [[ "X`which systemd`" = "X" ]]; then
|
||||||
|
systemd_exists=false
|
||||||
|
else
|
||||||
|
systemd_exists=true
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
## - restart clamv-daemon if process is not present
|
||||||
|
## -
|
||||||
|
if ! ps -ef | grep -v grep | grep /usr/sbin/clamd > /dev/null ; then
|
||||||
|
echo "clamd is down, so i try to start it.."
|
||||||
|
if $systemd_exists ; then
|
||||||
|
systemctl stop clamav-daemon > /dev/null 2> $tmp_err_msg
|
||||||
|
if [[ "$?" -ne 0 ]] ; then
|
||||||
|
cat $tmp_err_msg
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
systemctl start clamav-daemon > /dev/null 2> $tmp_err_msg
|
||||||
|
if [[ "$?" -ne 0 ]] ; then
|
||||||
|
cat $tmp_err_msg
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
/etc/init.d/clamav-daemon stop > /dev/null 2> $tmp_err_msg
|
||||||
|
if [[ "$?" -ne 0 ]] ; then
|
||||||
|
cat $tmp_err_msg
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
/etc/init.d/clamav-daemon start > /dev/null 2> $tmp_err_msg
|
||||||
|
if [[ "$?" -ne 0 ]] ; then
|
||||||
|
cat $tmp_err_msg
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#else
|
||||||
|
# echo "clamd is up. noting to do"
|
||||||
|
fi
|
||||||
|
|
||||||
|
## - restart clamv-freshclam if prozess is not present
|
||||||
|
## -
|
||||||
|
if ! ps -ef | grep -v grep | grep /usr/bin/freshclam > /dev/null ; then
|
||||||
|
echo "freshclam is down, so i try to start it.."
|
||||||
|
if $systemd_exists ; then
|
||||||
|
systemctl stop clamav-freshclam > /dev/null 2> $tmp_err_msg
|
||||||
|
if [[ "$?" -ne 0 ]] ; then
|
||||||
|
cat $tmp_err_msg
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
systemctl start clamav-freshclam > /dev/null 2> $tmp_err_msg
|
||||||
|
if [[ "$?" -ne 0 ]] ; then
|
||||||
|
cat $tmp_err_msg
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
/etc/init.d/clamav-freshclam stop > /dev/null 2> $tmp_err_msg
|
||||||
|
if [[ "$?" -ne 0 ]] ; then
|
||||||
|
cat $tmp_err_msg
|
||||||
|
fi
|
||||||
|
sleep 2
|
||||||
|
/etc/init.d/clamav-freshclam start > /dev/null 2> $tmp_err_msg
|
||||||
|
if [[ "$?" -ne 0 ]] ; then
|
||||||
|
cat $tmp_err_msg
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
#else
|
||||||
|
# echo "freshclam is up. noting to do"
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm $tmp_err_msg
|
||||||
|
exit 0
|
Loading…
Reference in New Issue
Block a user