Jump to content
Sign in to follow this  
acdii

Any Linux Gurus here?

Recommended Posts

I need to write a CRON script to restart BIND on Fedora every day. For some reason it stops resolving, and I believe it is due to too much recursion(I know Bad setup to allow recursion). Problem is it is our primary name server for our customers. It has been a few years since I did a CRON but that part I can figure out, its the script I am having a problem with.

Share this post


Link to post
Share on other sites

Which version of fedora?

BIND normally runs under the service "named". If you're just wanting to restart the processes nightly, you can restart that service. Older versions you can just use the init.d scripts (i.e. /etc/init.d/named restart) or the "service" command (/sbin/service named restart), providing you are able to run the cronjob as root.

 

I haven't played with the most recent version, but I seem to recall them moving away from both init.d and service commands, so they may not work.

Share this post


Link to post
Share on other sites

Its an older version, 15 I think, and can use either service named restart, or /etc/init.d/named restart.

 

I set a crontab as 04 22 * * * /etc/init.d/named restart under root, so will see if that works.

Share this post


Link to post
Share on other sites

How can I check to see if the job ran? Is there a log other than the message one that would show the services stop/starting?

Share this post


Link to post
Share on other sites

How can I check to see if the job ran? Is there a log other than the message one that would show the services stop/starting?

 

You could create a script, that appends a time/date stamp to a log file, and which also then runs the ".../named restart" command. Then put the call to your script in the crontab instead.

Share this post


Link to post
Share on other sites

How can I check to see if the job ran? Is there a log other than the message one that would show the services stop/starting?

 

There might be other ones, but the messages file is probably the easiest if you're just check that it stopped and started.

 

There should be lines in /var/log/messages similar to:

named[8474]: shutting down: flushing changes

named[8474]: stopping command channel on .....

....

named[27196]: starting BIND ....

 

 

Depending on how BIND is setup, it may have it's own log. I can't really say for sure where that would be because it's often setup to run in a chroot jail.

Share this post


Link to post
Share on other sites

I did find a log for cron and it is running on time, I will check the log tonight or later today when I have some time.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...