Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
My webalizer cron job is not running. I can easily run it manually:
Code:
$ sudo /etc/cron.daily/webalizer
5816807 records (2110442 ignored, 3246 bad) in 3045.50 seconds, 1909/sec
250033 records (108 bad) in 236.00 seconds, 1059/sec
The cron job is sitting right there in the cron.daily directory, but it never seems to run. What the heck? I do not receive any emails about success, failure, or even an attempt. I know for a fact that the logs are not processed because the destination directory (/var/www/webalizer) is untouched.
I'm much more familiar with traditional crontab stuff than the cron.daily directory. If anyone could help me sort this out, I'd be most grateful.
The /etc/crontab file does indeed look like it's trying to run the cron jobs. The logrotate cron certainly works as the logs all get rotated properly.
Code:
~$ sudo cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root cd / && run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly )
52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly )
#
Seems to me cron doesn't find the file.
Try to give the whole path to webalizer.
You can create a script.Kind regards
I'm not sure what you mean, repo. The basic webalizer script (/etc/cron.daily/webalizer) should in fact be found by the primary cron job on the server because it lives in /etc/cron.daily. The other cron jobs there appear to run just fine.
As described in my OP, if I run the command /etc/cron.daily/webalizer manually on the command line, it runs just fine.
If you look inside the file /etc/cron.daily/webalizer, this is what you see:
Code:
$ sudo cat /etc/cron.daily/webalizer
#!/bin/sh
# /etc/cron.daily/webalizer: Webalizer daily maintenance script
# This script was originally written by
# Remco van de Meent
# and now, all rewrited by Jose Carlos Medeiros
# This script just run webalizer agains all .conf files in /etc/webalizer directory
WEBALIZER=/usr/bin/webalizer
WEBALIZER_CONFDIR=/etc/webalizer
[ -x ${WEBALIZER} ] || exit 0;
[ -d ${WEBALIZER_CONFDIR} ] || exit 0;
for i in ${WEBALIZER_CONFDIR}/*.conf; do
# run agains a rotated or normal logfile
LOGFILE=`awk '$1 ~ /^LogFile$/ {print $2}' $i`;
# empty ?
[ -s "${LOGFILE}" ] || continue;
# readable ?
[ -r "${LOGFILE}" ] || continue;
# there was a output ?
OUTDIR=`awk '$1 ~ /^OutputDir$/ {print $2}' $i`;
# exists something ?
[ "${OUTDIR}" != "" ] || continue;
# its a directory ?
[ -d ${OUTDIR} ] || continue;
# its writable ?
[ -w ${OUTDIR} ] || continue;
# Run Really quietly, exit with status code if !0
${WEBALIZER} -c ${i} -Q || continue;
RET=$?;
# Non rotated log file
NLOGFILE=`awk '$1 ~ /^LogFile$/ {gsub(/\.[0-9]+(\.gz)?/,""); print $2}' $i`;
# check current log, if last log is a rotated logfile
if [ "${LOGFILE}" != "${NLOGFILE}" ]; then
# empty ?
[ -s "${NLOGFILE}" ] || continue;
# readable ?
[ -r "${NLOGFILE}" ] || continue;
${WEBALIZER} -c ${i} -Q ${NLOGFILE};
RET=$?;
fi;
done;
# exit with webalizer's exit code
exit $RET;
Where should I "give the whole path to webalizer" or "create a script" ?
But since the path is set in the script it should work.
And yet it does not. I've tried reading the man pages for cron. I don't fully understand when the cron.daily jobs get run. The man page says that the cron job should result in output to the syslog but I see no mention of the word 'webalizer' in the syslog. I do, however see this line from yesterday's syslog:
Code:
Aug 28 06:25:01 ip-10-64-70-28 CRON[15213]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
Is there some way that I might get a notification when webalizer runs? The cron man page mentions a MAILTO value that can be set but I'm not sure which file to set this in.
And yet it does not. I've tried reading the man pages for cron. I don't fully understand when the cron.daily jobs get run. The man page says that the cron job should result in output to the syslog but I see no mention of the word 'webalizer' in the syslog. I do, however see this line from yesterday's syslog:
Code:
Aug 28 06:25:01 ip-10-64-70-28 CRON[15213]: (root) CMD (test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ))
Is there some way that I might get a notification when webalizer runs? The cron man page mentions a MAILTO value that can be set but I'm not sure which file to set this in.
hi
cron.daily run at 6:25 every day
Code:
# m h dom mon dow user command
25 6 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily )
Thanks anomie. I'm guessing you mean for me to add the -x flag to the shebang in /etc/cron.daily/webalizer. I have made this change. Now I just have to wait 12 hours for it to run
As for the MTA, that is an excellent observation. I do in fact not deliver any mail at all locally on this machine as it's an Amazon EC2 instance. All mail destined for local user user_n should get mapped to user_n@mydomain.com, then sent to Amazon SES and from there to Google Apps where mail is hosted. I do get notifications from another script that runs in the root user's crontab file, but there's a chance that the notifications for cron.daily, cron.monthly, etc. are getting sent to some other user and I don't have a mailbox for that user. Is there any way I might find out where cron.daily notifications get sent? I'd be happy to check that.
If MAILTO is defined in /etc/crontab, mail will be sent to that address. If it is not defined, mail will be sent to the user the cronjob is running as -- in this case, root. (See the crontab(5) manpages for more details on that.)
If you're not explicitly forwarding root's mail, then it would be worthwhile to log in as him and check with mail(1).
MAILTO is not set in /etc/crontab. Every single job in that file runs as root, so email should be sent to "root", correct? Or is that "root@localhost" ? In either case, email should get through. These emails are forwarded by postfix to another email account to which I have access. I have not received any emails from the existing cron.daily, cron.monthly, or cron.hourly jobs, but I do receive daily an email from the root user's crontab file -- there's a notice generated by the script that I need to fix.
Is there some quick/easy way to check a lot file to see if any cron job notifications are getting lost? I know that the sender's address has caused problems in other situations.
I keep checking back but webalizer still doesn't seem to be running -- and I am not receiving any email about the job nor am I seeing the AHA-I-WAS-HERE file. Is there a chance the /tmp folder got cleaned up since the job ran? It's been about 12 hours.
I've checked the MTA's logs and I do see some messages bouncing, but given that the temp file is not being created, I'm starting to think that this cron job is not running at all.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.