Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Software
User Name
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.


  Search this Thread
Old 04-30-2009, 02:58 AM   #1
Registered: May 2006
Distribution: CentOS 5
Posts: 47

Rep: Reputation: 15
crond and sh looping if nfs fails on remote server

Hello there,

I've ran into the following problem:

I currently have a cron setup that runs every minute. It's basically something like:
* * * * * / > /mnt/otherserver
Problem is, if NFS fails on otherserver, I get an endless ammount of crond and sh populating the process list which eventually causes the load to increase as high as 80-100 which then causes other problems.

I've tried to fix the problem my mounting like this:
I believed the 20 second timeout would solve the problem but it did not.

Anyone could suggest something else to avoid this problem?

Thank You
Old 04-30-2009, 02:45 PM   #2
LQ Guru
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
You should modify so that it detects whether a copy is already running and exits if so. Something like this:


if ps -ef |grep |grep -v grep
then echo ERROR: already running.
exit 2
fi of the script...

That way it will abort regardless of the reason it is still running including NFS failure.
Old 04-30-2009, 09:10 PM   #3
LQ Guru
Registered: Aug 2004
Location: Sydney
Distribution: Centos 7.7 (?), Centos 8.1
Posts: 18,237

Rep: Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712Reputation: 2712
IMHO, even though cron can go down to 1 minute intervals, anything more than every 5 mins & I seriously consider writing a daemon instead.
all you need is

nohup infinite_loop_around_code &

Creating a new process every minute is adding to the system load unnecessarily. This also automatically avoids more than one copy running.
I'd also change the nfs params to use soft instead of hard.
You can easily get the daemon to check the mnt before trying to use it.


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
Debian Fails to Remount NFS Share on Server Reboot userlander Debian 3 02-13-2009 12:56 PM
NFS V4 mount fails - Server side says idmapping failing sixerjman Linux - Software 0 07-24-2007 10:05 PM
nfs install fails manual mounting remote share dohpaz Slackware - Installation 3 05-04-2007 12:00 PM
cron spawning extra crond - script fails jbob75 Linux - Software 2 11-21-2005 04:29 AM
rhel4 2.6.9-5.0.5.ELsmp nfs mount fails, server is down timvand Linux - Enterprise 1 04-24-2005 07:24 PM > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 07:44 PM.

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