avg will not work anymore [Solved]

This forum is for all copfilter version 2 support related questions in English. (IPCop version 2)
Post Reply
benscha
Posts: 29
Joined: 21 Jan 2014 11:52

avg will not work anymore [Solved]

Post by benscha » 22 Apr 2016 09:33

Hi Guys

my avg makes me some headache... i can't start the avg anymore

Code: Select all

root@copfilter:/usr/local/bin # ./copfilter_startavgscan
Starte avgscand <BR>Starting avgd (recovering)/opt/avg/av/etc/init.d/functions.common: line 175: /bin/rm: Argument list too long
 failed.
warte 1 Sekunde(n) <BR>
<font color='#993333'><b>FAILED</b></font><br />
avgscand laeuft nicht <BR>
i also tried to remove and reinstall all the additional Virusscanners with no success to bring up avg again.

this is the code of the functions.common around the line 175

Code: Select all

	 
173    #avgd is dead, clean mess (old pid and pipe files), before run
174        echo -n " (recovering)"
175   	  rm -f $AVG_RUN_DIR/*
176   	fi
does anyboby have an idea whats wrong with my avg?

thx for any hints!

ShelbyGT500
Posts: 846
Joined: 13 May 2010 22:37
Location: FRANCE

Re: avg will not work anymore

Post by ShelbyGT500 » 22 Apr 2016 16:48

Hi,

very strange..

Have a try with backup your file and replace the content of /opt/avg/av/etc/init.d/functions.common

with:

Code: Select all

# -*-Shell-script-*-
# This file contains common functions used by initscripts for all distributions 
# and defines generic init functions which can be overriden by distro-specific functions. 


############################################################
# Functions for detecting distribution.


# Format of variable DISTROS (3 items delimited by ':' character on each line):
# - extension of file sourced for detected distro (functions.extension)
# - file to look for when detecting distro
# - string to look for in the file (optional, see below)
# Order of distros is important (Ubuntu must precede Debian). 

DISTROS="
rh:/etc/redhat-release:RedHat
rh:/etc/redhat-release:Red Hat
rh:/etc/redhat-release:CentOS
rh:/etc/fedora-release:Fedora
rh:/etc/NeoShine-release:
rh:/etc/centos-release:
mdk:/etc/mandrake-release:
mdk:/etc/issue:Mandriva
mdk:/etc/issue:Mandrake
suse:/etc/SuSE-release:
ubuntu:/etc/lsb-release:Ubuntu
deb:/etc/debian_version:
slack:/etc/slackware-version:Slackware
gentoo:/etc/gentoo-release:
suse:/etc/SLOX-release:
rh:/etc/redhat-release:
suse:/etc/issue:SuSE"

detect_distro() 
{
    # workaround for freebsd
	if [ `uname -s` = "FreeBSD" ];
	then
		echo "freebsd"
		return 0;
	fi
	
	# the rest is for linux distros
	for d in $DISTROS ; do

	local file="${d#*:}"
	file="${file%:*}"

	# check file existence
	if [ -f "$file" ] ; then 

	    # check the string in file (empty string => we don't have to check)
	    local str="${d##*:}"
	    if [ -n "$str" ] ; then
		if [ `grep -c $str $file` -ne 0 ] ; then
		    # echo extension
		    echo ${d%%:*}
		    return 0
		fi
	    else	
		# echo extension
		echo ${d%%:*}
		return 0
	    fi
	fi
    done

    return 1
}

# wait until avgd pid-file exist or time's out
# if time's out, kill avgd and his childern
wait_and_kill()
{
	# wait until pid-file exist or time's out
	i=$AVG_WAIT_FOR_PID_TIME
	while [ $i -gt 0 ]
	do
     if [ -f "$AVG_PID_FILE" ] ; then	
		 echo -n "."
	    i=`expr $i - 1`
       sleep 2s
	  else 
       i=0
	  fi
	done

	# if avgd is still running, kill it and all his childern (ps ppid==pid avgd)
   if [ -f "$AVG_PID_FILE" ] ; then	
	  PID=`cat "${AVG_PID_FILE}"`
	  PIDS=`ps axopid,ppid,ruser | grep -w $PID | grep -w $SUSER | awk '{print $1}' | tr '\n' ' '`
	  if [ -n "$PIDS" ] ; then
	    printf "\r killing $AVG_DAEMON and his components with pids: ($PIDS)"
	    kill -KILL $PIDS
	    RETVAL=$?
       [ $RETVAL -eq 0 ] && rm -f $AVG_PID_FILE
	  else
	    RETVAL=2
	  fi
     sleep 2s
	fi
	return $RETVAL
}


# Return values are LSB-compliant.
# Should set the value of RETVAL to return value.
dist_status() 
{
    if [ -f "$AVG_PID_FILE" ] ; then
      PID=`cat "${AVG_PID_FILE}"`
	   ISRUN=`ps axo pid,comm | grep -w $PID | grep -w ${AVG_DAEMON}`
      if [ -n "$ISRUN" ] ; then
	     echo -n "(pid $PID) is running"
        RETVAL=0
      else
	     echo -n "$AVG_DAEMON dead but pidfile exists"
	     RETVAL=1
      fi	
    elif [ -n "$AVG_LOCK_FILE" -a -f "$AVG_LOCK_FILE" ] ; then
	   echo -n "${AVG_DAEMON} dead but subsys locked"
	   RETVAL=2
    else 
	   echo -n "$AVG_DAEMON is not running"
	   RETVAL=3
    fi
    return $RETVAL
}


# Stops the daemon (and waits until his pidfile is removed).
# Should set the value of RETVAL to return value.

dist_stop()
{
   if [ -f "$AVG_PID_FILE" ] ; then	
     PID=`cat $AVG_PID_FILE 2>/dev/null`
	  $AVG_CTL --stop >/dev/null 2>&1
	  RETVAL=$?
     if [ -f "$AVG_PID_FILE" ] ; then
	    ISRUN=`ps axo pid,comm | grep -w $PID | grep -w ${AVG_DAEMON}`
	    [ -n "${ISRUN}" ] && wait_and_kill
		 RETVAL=$?
	  fi
   else
	  echo -n " (not running)"
	  RETVAL=0
   fi

   return $RETVAL
}


# Should set the value of RETVAL to return value.
# Note: Used for FreeBSD currently.

dist_start()
{
	# if daemon is not running, nothing should be in RUN_DIR
   if [ -n "`ls $AVG_RUN_DIR`" ] ; then
	  # See if it's already running.
     if [ -f "$AVG_PID_FILE" ] ; then
	    PID=`cat $AVG_PID_FILE`
	    ISRUN=`ps axo pid,comm | grep -w $PID | grep -w ${AVG_DAEMON}`
	    if [ -n "${ISRUN}" ] ; then
	      #avgd is running = do nothing
	      echo -n " (already running with pid: $PID)"
	      RETVAL=0
	      return $RETVAL
	    fi
	  fi
	  #avgd is dead, clean mess (old pid and pipe files), before run
     echo -n " (recovering)"
	  rm -f $AVG_RUN_DIR/*
	fi

	# make sure it doesn't core dump anywhere unless requested
	ulimit -S -c ${DAEMON_COREFILE_LIMIT:-0} >/dev/null 2>&1
	
	# if they set NICELEVEL, honor it
	[ -n "$NICELEVEL" ] && nice="nice -n $NICELEVEL"

	# check and fix configuration
	$nice "$AVG_DIAG" --fixcfg >/dev/null 2>&1

	# And start it up.
	if [ "$SUSER" = "root" ] ; then	    
	  $nice "$AVG_CTL" --start >/dev/null 2>&1
	else
	  $nice su -s /bin/sh -c "$AVG_CTL --start >/dev/null 2>&1" $SUSER
	fi	
	RETVAL=$?	
   return $RETVAL
}



############################################################
# Functions for echoing


dist_echo_status_begin()
{
    echo -n "Checking for service ${AVG_DAEMON}: "
}


dist_echo_status_end()
{
    echo
}


dist_echo_start_begin()
{
    echo -n "Starting $AVG_DAEMON"
}


dist_echo_start_end()
{
    [ "$RETVAL" -eq 0 ] && echo " OK." || echo " failed."
}


dist_echo_stop_begin()
{
    echo -n "Shutting down $AVG_DAEMON"    
}


dist_echo_stop_end()
{
    [ "$RETVAL" -eq 0 ] && echo " OK." || echo " failed."
}
Regards.

ShelbyGT500

benscha
Posts: 29
Joined: 21 Jan 2014 11:52

Re: avg will not work anymore

Post by benscha » 25 Apr 2016 08:19

Hi Shelby

thx for your reply. unfourtainely the script did not change anything.

Code: Select all

-rw-r--r-- 1 root root  5320 Apr 22 09:08 functions.common
the script will alos not give an output.


benscha

ShelbyGT500
Posts: 846
Joined: 13 May 2010 22:37
Location: FRANCE

Re: avg will not work anymore

Post by ShelbyGT500 » 25 Apr 2016 22:14

Hi Bensha,

Sorry, I've not many time this week to have a deep look ! :D

Have a try with this : back up your opt/avg/ folder and replace it with this:
http://shelby.eurowireless.de/Fix/avg.tar.gz

regards.

ShelbyGT500

benscha
Posts: 29
Joined: 21 Jan 2014 11:52

Re: avg will not work anymore

Post by benscha » 26 Apr 2016 11:02

Hi ShelbyGT500

Image

thx for the file! everything is working again!

ShelbyGT500
Posts: 846
Joined: 13 May 2010 22:37
Location: FRANCE

Re: avg will not work anymore

Post by ShelbyGT500 » 26 Apr 2016 12:35

Hi,
benscha wrote:everything is working again!
Glad to hear! :D
Then, I change the post to [solved] :D .

Regards.

ShelbyGT500

Post Reply