Hi Dublin,
I put --notify-sender and --notify-admin options in /etc/init.d/avastrelay as you told me,I inserted them in the configuration bloc. then When I restart avastrelay I have the following error:
/etc/init.d/avastrelay: line 52: --notify-sender: command not found
/etc/init.d/avastrelay: line 53: --notify-admin: command not found
Would you please tell me where exactly should I insert this two lignes? or correct my syntaxe if it’s wrrong.
I forward you my avastraly file :
#!/bin/sh
avastrelay
A shell-script wrapper for avastrelay designed for
use in the SysV-init system.
usage: avastrelay { start [] | stop | restart | force-reload | status }
RedHat comment block…
chkconfig: 345 80 30
description: Virus check Message Transfer Agent.
pidfile: /var/run/avastrelay.pid
processname: avastrelay
LSB comment block…
BEGIN INIT INFO
Provides: avastrelay
Required-Start: $network $syslog
Required-Stop: $network $syslog
Default-Start: 3 4 5
Default-Stop: 0 1 2 6
Description: avastrelay is a virus check Message Transfer Agent.
END INIT INFO
Source function library.
if test -f /etc/init.d/functions
then
style=“rh”
. /etc/init.d/functions
elif test -f /etc/rc.status
then
style=“suse”
. /etc/rc.status
elif test -f /lib/lsb/init-functions
then
style=“lsb”
. /lib/lsb/init-functions
else
style=“unix”
fi
avastrelay configuration
avastrelay=“/usr/sbin/avastrelay”
switches=“-ilocalhost:10025 -Ilocalhost:10026 -a/var/run/avast4mailscanner.sock -l/var/log/avast4/avastrelay -t60”
pid_file=“/var/run/avastrelay.pid”
–notify-sender
–notify-admin latifa@RedHat.test.com
Functions
function printtext( )
{
case “${style}” in
rh | suse | unix )
echo -n $* >&2
;;
lsb)
lsb_text=“$@”
;;
esac
}
function printusage( )
{
usage=“{ start []|stop|restart|force-reload|status }”
echo “usage: basename $0
${usage}” >&2
}
function getstatus( )
{
case “${style}” in
rh)
echo
[ “$?” -eq 0 ]
;;
suse)
rc_status $@
;;
lsb)
if test “$?” -eq 0 -a “${1}” = “-v”
then
log_success_msg “${lsb_text} done”
elif test “${1}” = “-v”
then
log_failure_msg “${lsb_text} failed”
fi
;;
unix)
if test “${1}” = “-v” -a “$?” -eq 0
then
echo " … done"
fi
if test “${1}” = “-v” -a “$?” -ne 0
then
echo " … failed"
fi
;;
esac
}
function startproces( )
{
printtext “Starting avastrelay:”
case “${style}” in
rh)
daemon $@
;;
suse)
startproc $@
;;
lsb)
start_daemon $@
;;
unix)
$@
;;
esac
getstatus -v
}
function killproces( )
{
printtext “Shutting down avastrelay:”
case “${style}” in
rh | lsb)
killproc “basename \"${1}\"
”
;;
suse)
killproc $@
;;
unix)
if test -f “${pid_file}” && test “cat ${pid_file}
” != “”
then
kill “cat ${pid_file}
”
fi
;;
esac
getstatus -v
}
function checkprocess( )
{
case “${style}” in
suse | lsb | unix)
printtext “Checking for avastrelay:”
;;
esac
base="`basename \"${1}\"`"
case "${style}" in
rh)
status "$base"
;;
suse)
checkproc $@
;;
lsb)
pids="`pidofproc \"${base}\" | sed 's/ *$//'`"
test "${pids}" != ""
;;
unix)
test -f "${pid_file}" && test "`cat ${pid_file}`" != "" && kill -0 "`cat ${pid_file}`" 2>/dev/null
;;
esac
case "${style}" in
lsb | suse | unix)
getstatus -v
;;
esac
}
Check that avastrelay exists.
[ -f “${avastrelay}” ] || exit 1
Check the command line
if test $# -eq 0
then
printusage
exit 2
fi
Process the command line
case “${1}” in
start)
startproces “${avastrelay} ${switches}”
;;
stop)
killproces “${avastrelay}”
;;
restart|force-reload)
$0 stop
$0 start $@
;;
reload)
echo usage: basename $0
reload: not implemented >&2
exit 3
;;
status)
checkprocess “${avastrelay}”
;;
*)
printusage
exit 2
;;
esac
exit $?
Think’s
Latifa.