diff options
author | Michał Masłowski <mtjm@mtjm.eu> | 2011-12-18 15:46:12 +0100 |
---|---|---|
committer | Michał Masłowski <mtjm@mtjm.eu> | 2011-12-18 15:46:12 +0100 |
commit | 82e56b34417677fc5ad8718a516874fb5351e60f (patch) | |
tree | 2f157396a89875f5f3543c62e7f4d5f9042cfb94 /extra/clamav/rc.d | |
parent | e63aad93b3e68c372e525d86c3277b2fa4bddb24 (diff) | |
parent | 146025aa1c838c12fa7b4873414da73816bfb6bd (diff) |
Merge branch 'master' of ssh://parabolagnulinux.org:1863/home/parabola/abslibre-pre-mips64el
Conflicts:
community/python2-pymongo/PKGBUILD
extra/clamav/PKGBUILD
extra/claws-mail-extra-plugins/PKGBUILD
extra/lcms2/PKGBUILD
extra/libxi/PKGBUILD
extra/xorg-server/PKGBUILD
multilib/wine/PKGBUILD
Diffstat (limited to 'extra/clamav/rc.d')
-rw-r--r-- | extra/clamav/rc.d | 117 |
1 files changed, 56 insertions, 61 deletions
diff --git a/extra/clamav/rc.d b/extra/clamav/rc.d index 8e9c6afa9..04e959903 100644 --- a/extra/clamav/rc.d +++ b/extra/clamav/rc.d @@ -3,70 +3,65 @@ . /etc/rc.conf . /etc/rc.d/functions -# source application-specific settings -[ -f /etc/conf.d/clamav ] && . /etc/conf.d/clamav +[[ -f /etc/conf.d/clamav ]] && . /etc/conf.d/clamav +[[ -d /var/run/clamav ]] || install -d -o clamav -g root /var/run/clamav -PID_FC=`pidof -o %PPID /usr/bin/freshclam` -PID_CD=`pidof -o %PPID /usr/sbin/clamd` +PID_FC=$(pidof -o %PPID /usr/bin/freshclam) +PID_CD=$(pidof -o %PPID /usr/sbin/clamd) case "$1" in - start) - # if clamd isn't started first, notifyclamd fails at times - if [ "$START_CLAMD" == "yes" ]; then - stat_busy "Starting ClamD" - [ -z "$PID_CD" ] && /usr/sbin/clamd - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon clamav - stat_done - fi - fi + start) + if [[ $START_CLAMD = yes ]]; then + stat_busy "Starting ClamD" + [[ -z $PID_CD ]] && /usr/sbin/clamd + if [[ $? -gt 0 ]]; then + stat_fail + else + add_daemon clamav + stat_done + fi + fi + sleep 1 + if [[ $START_FRESHCLAM = yes ]]; then + stat_busy "Starting FreshClam" + [[ -z $PID_FC ]] && /usr/bin/freshclam -p /var/run/clamav/freshclam.pid -d $FRESHCLAM_OPTS + if [[ $? -gt 0 ]]; then + stat_fail + else + add_daemon clamav + stat_done + fi + fi + ;; + stop) + if [[ $START_CLAMD = yes ]]; then + stat_busy "Stopping ClamD" + [[ -n $PID_CD ]] && kill $PID_CD &> /dev/null + if [[ $? -gt 0 ]]; then + stat_fail + else + rm_daemon clamav + stat_done + fi + fi - # give clamd enough time to start - sleep 1 - - if [ "$START_FRESHCLAM" == "yes" ]; then - stat_busy "Starting FreshClam" - [ -z "$PID_FC" ] && /usr/bin/freshclam -p /var/run/clamav/freshclam.pid -d $FRESHCLAM_OPTS - if [ $? -gt 0 ]; then - stat_fail - else - add_daemon clamav - stat_done - fi - fi - ;; - stop) - if [ "$START_CLAMD" == "yes" ]; then - stat_busy "Stopping ClamD" - [ -n "$PID_CD" ] && kill $PID_CD &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon clamav - stat_done - fi - fi - - if [ "$START_FRESHCLAM" == "yes" ]; then - stat_busy "Stopping FreshClam" - [ -n "$PID_FC" ] && kill $PID_FC &> /dev/null - if [ $? -gt 0 ]; then - stat_fail - else - rm_daemon clamav - stat_done - fi - fi - ;; - restart) - $0 stop - # will not start if not fully stopped, so sleep - sleep 2 - $0 start - ;; - *) - echo "usage: $0 {start|stop|restart}" + if [[ $START_FRESHCLAM = yes ]]; then + stat_busy "Stopping FreshClam" + [[ -n $PID_FC ]] && kill $PID_FC &> /dev/null + if [[ $? -gt 0 ]]; then + stat_fail + else + rm_daemon clamav + stat_done + fi + fi + ;; + restart) + $0 stop + sleep 2 + $0 start + ;; + *) + echo "usage: $0 {start|stop|restart}" esac exit 0 |