LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 06-30-2005, 11:46 AM   #1
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Rep: Reputation: 31
Question NFS and Cron jobs


Hi--

Now that my new box is up and running 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 shared NFS filesystem 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"):
Code:
/var/log/messages:
Jun 29 21:34:30 bak kernel: nfs warning: mount version older than kernel
Here is my /etc/crontab:
Code:
# /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:
Code:
/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:
Code:
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?
 
Old 06-30-2005, 02:20 PM   #2
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
Can you run the scripts sucessfully directly from the command line?

I am not sure what the point of "set $(date)" is.
 
Old 06-30-2005, 02:21 PM   #3
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
Oops, I just noticed the bigger problem: why are you using run-parts with the name of a script? run-parts is supposed to take the name of a directory. To just run a single script, omit run-parts.
 
Old 06-30-2005, 06:30 PM   #4
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Original Poster
Rep: Reputation: 31
David--

Thanks!

OK, I will take out the run-parts parts. Never knew what that was for, so I was just copying.

Am running one of the scripts right now and it seems to be working.

Will report back.

David, thank you very much!
 
Old 06-30-2005, 07:29 PM   #5
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
No problem.

run-parts runs all scripts contained in a directory. I believe it parallelizes execution, but that I am not sure of.
 
Old 07-01-2005, 10:34 AM   #6
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Original Poster
Rep: Reputation: 31
David--

Thanks!

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.

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

Code:
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
 
Old 07-01-2005, 10:46 AM   #7
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
Those jobs are running all your "normal" routine cron jobs.... If you don't have any other jobs (including, for example, updates of the 'locate' database) then this is not a problem. I would leave them in, myself.

Everything in /etc/cron.hourly is supposed to be run EVERY hour. Everything in /etc/cron.weekly is supposed to be run each week, and so forth.
 
Old 07-01-2005, 08:57 PM   #8
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Original Poster
Rep: Reputation: 31
Question

David--

OK, I get it. I think.

I could set up my own directory, say cron.doug, and put all my special stuff in there, and run it as I wish.

That's why when I put in cron.hourly fileA to be run on even hours from 9 am to 7 pm and another to run on odd hours, were getting run every hour, around the clock, right? Except only one of those two was being run.

Thanks, David! You are a good teacher.
 
Old 07-01-2005, 09:02 PM   #9
Matir
LQ Guru
 
Registered: Nov 2004
Location: San Jose, CA
Distribution: Ubuntu
Posts: 8,507

Rep: Reputation: 125Reputation: 125
That's exactly why it was occuring.

You can actually use the crontab utility to install cronjobs of your own as you want, to run any script.
 
Old 07-05-2005, 10:38 PM   #10
dgermann
Member
 
Registered: Aug 2004
Distribution: Ubuntu 16.04 lts desk; Ubuntu 14.04 server
Posts: 346

Original Poster
Rep: Reputation: 31
Thanks, David!

Thanks to your help I was able to get it going.

Pretty much all is well!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Jobs XaViaR Linux - General 1 06-23-2005 06:57 PM
cron jobs working2hard Linux - Software 0 07-28-2004 05:31 PM
CRON Jobs scottpioso Linux - Software 63 11-28-2003 06:45 PM
CVS and cron jobs cleaner416 Linux - Newbie 2 09-18-2003 06:21 PM
cron jobs Zyanid Linux - Software 0 08-27-2002 05:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 03:39 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration