Koozali.org: home of the SME Server

Missing anacrontab file (and a question about crontab)

Brendan Wajon

Missing anacrontab file (and a question about crontab)
« on: December 19, 2002, 06:17:09 AM »
HELP!!!

In trying to add a line to the anacrontab file using the e-smith template system, I screwed it up. It cleaned out the original anacrontab and made a new one with only my daily "check for virus-updates" line :-(.

I'm using the latest version of SME 5.5.

Could someone sent me his anacrontab file located in /etc ?

I just can't remember which paths were specified in the original, that was quite a line. The only I remember are the lines for running the cron.weekly and cron.monthly scripts.

Question # 2:
I've tried to add the line:
* 3 * * 4 root /usr/local/uvscan/update-uvscan.sh (updating the dat-files of McAfee uvscan every thursday at 3 am GMT+1)
to the crontab file using the e-smith template system, no harm there.
I got a lot of e-mail from the Cron Daemon with the following message:
/usr/local/uvscan/update-uvscan.sh: [: 4238: unary operator expected

What can I do about that? It runned the script fine, but it kept sending me these mails. As a solution I removed the same line using the template-system.
Then tried the "anacron"-way but messed that up badly.
Could someone give me a hint why I got that peculiar [:4238: unary operator expected error? And how to get rid of that, but not te be forced to check for updates manually?

Content of update-uvscan.sh:
#!/bin/sh
#
# Script to update McAfee VirusScan for Unix (uvscan) virus definitions.
# Place it in the uvscan installation directory and run it from crontab
# (preferrably daily). Check regularly that the download URLs are still valid.
#
# This script is hereby placed on the public domain.
#

cd dirname $0
wget -t 0 -c ftp://ftp.nai.com/pub/datfiles/english/dat-*.tar >wget.log 2>&1
if [ $? -eq 0 ]
then
  INUSE=/usr/local/bin/uvscan --version | awk '($2 == "data") {print substr($4,2)}'
  WEGOT=ls dat-*.tar 2>/dev/null | tail -1 | awk '{print substr($0,5,length($0)-8)}'
  if [ $WEGOT -gt $INUSE ]
    then
      tar xf dat-$WEGOT.tar 2>/dev/null
      echo date +"%Y/%m/%d %H:%M:%S" "Do update ($WEGOT > $INUSE)." >>updatedat.log
  else
      echo date +"%Y/%m/%d %H:%M:%S" "Don't update ($WEGOT <= $INUSE)." >>updatedat.log
  fi
else
     mv wget.log wget-error.log
     echo date +"%Y/%m/%d %H:%M:%S" "Download error -- see wget-error.log" >>updatedat.log
fi

Thank in advance,

Brendan

Jon Blakely

Re: Missing anacrontab file (and a question about crontab)
« Reply #1 on: December 19, 2002, 02:26:52 PM »
Brendon,

# /etc/anacrontab: configuration file for anacron

# See anacron(8) and anacrontab(5) for details.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin

# These entries are useful for a Red Hat Linux system.
1       5       cron.daily              run-parts /etc/cron.daily
7       10      cron.weekly             run-parts /etc/cron.weekly
30      15      cron.monthly    run-parts /etc/cron.monthly


Jon

Brendan Wajon

Thank for the anacrontab file
« Reply #2 on: December 19, 2002, 03:26:16 PM »
Thanks Jon

Just copied and pasted it. Everything is ok now.

Brendan

Brendan Wajon

about the [:4238: unary operator expected error
« Reply #3 on: December 19, 2002, 03:44:20 PM »
I checked the the version of McAfee uvscan and it gave an error that the scan.dat file was not correcty updated. This error caused the script to malfunction, it doesn't have a fallback if something did go wrong with the update. And if it doesn't get the expected return of the command: uvscan --version (the version with the dat release file) it just go berserks :-). This gave me the [:4238: unary operator expected error.

This matter is closed now for me, I got my answers.

Brendan