Re: [squid-users] Squid Report not working

From: Adam <adam-s@dont-contact.us>
Date: Wed, 13 Aug 2003 10:25:43 -0700

Jim wrote:
> I have a report that I am trying to run with the below script. I use
> crontab to start the job although the job never seems to start.
1. Did you try running it from the command line and does that work? If not
did you make the script executable (chmod 755 script)
2. iall stdout/err generated by a script run under cron is mailed to the
user under whose cron that script was run - so check your or root's mail
  for any error messages (though running from the command line might show
them as well.
3. Unix shell questions should be asked on the mailing list or newsgroup of
your choice. For example if you use linux/Redhat you might try one of their
groups though my preference is comp.unix.shell which you can access via
groups.google.com
4. What does your cron line look like? Maybe there is an error there an it
is silently failing. Again checking the mail of the user running the
cronjob should show it. Also cron (at least on Suns) is sensitive about
blank lines so make sure there are none. Also the time you think you are
setting may not be what you expected. On Sun's the following line would run
at 21 minutes after 3pm (24h time) on the 14th of August. Don't use the Day
(Tues, Wed) field as it's day OR date:
21 15 14 8 * /usr/local/bin/sarg.weekly

> Does the script look good,
Mostly looks normal/find, but again try running it from the command line and
see if anything happens.

> cat /etc/cron.d/sarg.weekly
Why is your script in the cron.d access controls directory? Put it wherever
Linux scripts normally go (I use /usr/local/bin but I use Solaris).

> #!/bin/bash
Under Solaris, cron only runs under bourne shell (/bin/sh) - I am assuming
Linux is not so braindead but it's another thing you might check.

> TODAY=$(date +%d/%m/%Y)
Since "/" (slash) is a meta/special character to the shell, I would suggest
using some other delimiter, like a "-" (dash).
Also since cron uses a limited path, I usually give the full path to any
program I call. So use the full path for your date command. Probably
irrellevant but a good habit (or just set the PATH=.... stuff at the top of
your script).

> LASTWEEK=$(date --date "7 days ago" +%d/%m/%Y)
This and the above date line worked for me when I used gdate which I assume
is what Linux uses named as date. Just be sure to use the full path as when
you run it from the command line it is using your PATH and so perhaps it is
calling the wrong date command when run from cron which doesn't use your
PATH.

> /usr/bin/sarg -d $LASTWEEK-$TODAY
Perhaps sarg is not properly configured? Try running the 3 lines in your
script exactly as they are, in order, directly from the command line and see
if it gives an error or fails silently.

hth

Adam
Received on Wed Aug 13 2003 - 11:26:46 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 17:18:53 MST