i'm written a very simple bash script to run webalizer on my web logs, and it works fine. when i set up a cron job to run it every half hour however, it says the command cannot be found just running it: Code: [root@Gemini root]# sh /home/stat-www.pl Webalizer V2.01-10 (Linux 2.4.18-3smp) English Using logfile /home/www/logs/access.log (clf) Creating output in current directory Hostname for reports is 'Gemini.ihateaol.co.uk' Reading history file... webalizer.hist Generating report for October 2002 Generating report for November 2002 Generating summary report Saving history information... 11704 records in 0.71 seconds [root@Gemini root]# but i get this email when it is run as a cron job: Code: From [email]root@Gemini.ihateaol.co.uk[/email] (Cron Daemon) To [email]root@Gemini.ihateaol.co.uk[/email] Date Thu, 14 Nov 2002 20:00:01 GMT Subject Cron <root@Gemini> sh /home/stat-www.pl /home/stat-www.pl: webalizer: command not found any ideas?
For some reason the script cant find webalizer when you are running the script, care to post the script? Shak
all it is is: #!/bin/bash cd /home/www/html/misc/stat webalizer /home/www/logs/access.log has to change to the stat directory first cos thats where it generates the files when webalizer is run
Probably the script doesn't run with the path to where webalizer is. try using the full path to it. need help finding it? do Code: whereis webalizer from a shell
i perfer find / -name webalizer also, running the cron job manually worked, and nothing had any trouble finding webalizer any other time. we'll see if this works in 25 mins anyway
Yeah, you'll need to put in the full path of webalizer. With everything in cron you will need full paths. So something like: Code: #!/bin/bash cd /home/www/html/misc/stat /usr/bin/webalizer /home/www/logs/access.log
*steps away slowly* heh From the top of my crontab file (crontab -e) for example HTH EDIT: beaten to it by Mpemba Effect *sigh*
How did you install it into cron? Pop the script into /etc/cron.hourly or into crontab -e? Im guessing its the first in which case it probs a cron config setting.... a quick look round /etc and I cant see anything obvious tho..
sweet now for the super simple problem... the server clock is wrong, how can i set it and keep it synchronised? i added "server <time server IP>" to /etc/ntp.conf but i dunno what to do from there. RH 7.3
If I were you i'd just add a cronjob that just runs /usr/sbin/ntpdate <server> e.g. /usr/sbin/ntpdate ntp.pipex.net
[root@Gemini etc]# /usr/sbin/ntpdate ntp.demon.nl 15 Nov 00:01:46 ntpdate[15656]: step time server 194.159.73.44 offset 3400.608745 sec haha you guys rock thanks a lot