Click to See Complete Forum and Search --> : NFS and Cron jobs


dgermann
06-30-2005, 12:39 PM
Hi--

Thanks to the great help of Knute, I managed to get my new box up and running. Thanks, Knute! :D

Now I have set up some cron jobs to do some backups from some NFS shares. Only they are not getting made. Can you help me figure out what is going on?

Yes, I can access the NFS files on the new box.

Here is the only error message from /var/log/messages that looks to me to have anything to do with cron and nfs--this was at the time I mounted the nfs shares on the new computer (The new box is named "bak"):

/var/log/messages:
Jun 29 21:34:30 bak kernel: nfs warning: mount version older than kernel


Here is my /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.
# This file also has a username field, 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 run-parts --report /etc/cron.hourly
25 6 * * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.daily
47 6 * * 7 root test -e /usr/sbin/anacron || run-parts --report /etc/cron.weekly
52 6 1 * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.monthly

## added by ddg, 2005/06/29:

01 9,11,13,15,17,19 * * * root run-parts /etc/cron.hourly/bkhourod
01 10,12,14,16,18 * * * root run-parts /etc/cron.hourly/bkhourev
02 4 * * 1,3,5 root run-parts /etc/cron.daily/bkdaily1
02 4 * * 0,2,4,6 root run-parts /etc/cron.daily/bkdaily2
22 4 * * 0 root run-parts /etc/cron.weekly/bkweekly
42 4 1 * * root run-parts /etc/cron.monthly/bkmonthly



Here is /etc/cron.hourly/bkhourod:

/etc/cron.hourly/bkhourod:

#!/bin/sh
set $(date)
filename="/backups/hourly`date +'%H'`.tgz"
tar cvfz /$filename /sam/vol22/data /sam/vol22/comm/tap /sam/doug2/all-y /sam/etc
exit

#




Finally, here is another excerpt from /var/log/messages:

More /var/log/messages:
Jun 30 03:48:34 bak -- MARK --
Jun 30 04:08:34 bak -- MARK --
Jun 30 04:28:34 bak -- MARK --
Jun 30 04:48:34 bak -- MARK --
Jun 30 05:08:34 bak -- MARK --
Jun 30 05:28:34 bak -- MARK --
Jun 30 05:48:34 bak -- MARK --
Jun 30 06:08:34 bak -- MARK --
Jun 30 06:25:29 bak syslogd 1.4.1#14ubuntu4: restart.
Jun 30 06:48:34 bak -- MARK --
Jun 30 07:08:34 bak -- MARK --
Jun 30 07:28:34 bak -- MARK --



So it looks to me from those times that cron is doing something at (some of) the appointed times. I do not know where to look for the output of those first few cron jobs, to see if anything is actually getting done.

What do you see? How might I get this to work?

techwise
06-30-2005, 03:10 PM
does the script work as desired if run manually?

you could have cron mail you the results.

just curious, why use the system wide cron rather than roots crontab?

Mike

dgermann
06-30-2005, 07:27 PM
Mike--

does the script work as desired if run manually?

Well, I am running one of them at the moment and it seems to be working. After I remembered to chmod 744 it. ;)

you could have cron mail you the results.

After I posted I found several such mails. The short version is it says "/etc/cron.hourly/bkhourod is not a directory."

So this is a major clue. It is not a directory indeed, it is a file. What does it want me to put there? And how do I get it to execute one of two files I have there?

just curious, why use the system wide cron rather than roots crontab?

Only because I did not know there was any other crontab. What is the advantage of using one over the other, if you please, Mike?

Thanks Mike for your quick and incisive reply!

dgermann
07-01-2005, 11:34 AM
Well, I have it working, sort of.

I took out the parts about run-parts, then found that the bkhourev was running each hour. So I commented out the first four cron jobs, the ones the distro had inserted there.

Anybody have any idea what those four jobs are doing, and if I should not have commented them out? They are:


17 * * * * root run-parts --report /etc/cron.hourly
25 6 * * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.daily
47 6 * * 7 root test -e /usr/sbin/anacron || run-parts --report /etc/cron.weekly
52 6 1 * * root test -e /usr/sbin/anacron || run-parts --report /etc/cron.monthly