Re: Question on setting up cron job
- Your script is being executed in the cron folder. This means that if
the cron script is in /etc/cron.daily then "./" is "etc/cron.daily"
and "../" will become "/etc".
"./*/*/access.*" was probably nothing, because "/etc/cron.daily" has
no subdorectories, and "../web/stats" was "/etc/web/stats".
To solve this problem, put can this line at the start of the script:
Or you can put absolute paths instead of relative.
I have written some scripts below.
Your script was like this:
# non-working cron script
for i in ./*/*/access.*
do webalizer -o ../web/stats/ $i;
And would become this:
# relative paths script
for SITE in /home/sites/* ; do
for j in ./access.*
do webalizer -o ../web/stats/ $j;
Or perhaps this:
# absolute paths script
for i in $SITESPATH/* ; do
for j in $LOGPATH/access.*
do webalizer -o $SITESPATH/web/stats/ $j;
--- In firstname.lastname@example.org, Bradley Miller <bradmiller@a...>
> Does anyone have a suggestion for how to get a cron job to workwith my
> webalizer? I have my files like this:2003
> /home/sites/companya/logs/2003/11/access.01 - day 1, november,
> /home/sites/companya/logs/2003/11/access.02 - day 2, november, 2002003
> /home/sites/companyb/logs/2003/11/access.01 - day 1, november,
> /home/sites/companyb/logs/2003/11/access.02 - day 2, november, 200location. So
> To clarify that -- the script goes under each web site's
> This was my first attempt (analyze.sh):
> for i in ./*/*/access.*
> do webalizer -o ../web/stats/ $i;
> The problem is I think the script isn't running right when called
> cronjob. Any suggestions?