The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > HP-UX
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #13 (permalink)  
Old 09-16-2009
rwuerth rwuerth is offline
Registered User
  
 

Join Date: Jan 2009
Location: Va. Beach
Posts: 64
This is a timely topic for me. I was looking into just such a problem since I have a two node Service Guard cluster, in use. We have an applications volume group active on only one server at a time. Depending upon which server it is active on, the crontab file has extra jobs to run.

So I thought of having a dedicated and separate area for the local crontab file, and one on the application volume group for the crontab file specific to it.

Then a script could be made to merge the local cron job file with the cron file from the application volume group (if it's mounted) and then submit the merged crontab file to cron. This script would run with the startup of the cluster package for the application volume group.

The local crontab file would look something like this

Code:
 
#<header info>
# LOCAL start
<cron job>
<another cron job>
<etc>
# LOCAL end
And the app volume group crontab file

Code:
 
# APP start
<cron job>
<another cron job>
<etc>
# APP end
A script could easily cat those two files, together into a new crontab file keeping the application specific information last in the file. The process can be "reversed" by resubmitting just the local file when the app volume group is switched back to its primary node. If changes were made in the meantime, to the local portion, no problem, as a simple:

Code:
 
crontab -l | sed -n -e '1,/\# LOCAL end/ p' > newlocal.cron
should give me the most current local listing that can be submitted to eliminate the application volume group entries (of course the changes should have been made to a separate file first, and then submitted so I already have a record of them).

I haven't put this together, yet, it's just been rattling around in my brain at this point, but that's the gist of it. Seems so easy, I must be missing something!