- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: MC/SG and cron jobs
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 10:32 AM
тАО09-10-2002 10:32 AM
We're running a two-node cluster, and I would like to fail over the cron jobs that should be running on the primary node when it fails. So far the best that I've been able to come up with it to copy the crontab for the operator user to a different name on the backup server, and then change the name in the cluster script, followed by the crontab command to kick it off. The question that now occurs to me is "Isn't the cron now assigned to root?". Anybody else trying to do the same thing or know of a clean way to handle this? Thanks for any help.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 10:39 AM
тАО09-10-2002 10:39 AM
Re: MC/SG and cron jobs
I got a two-node cluster as well. I did it differently. I have the same cron jobs running on both nodes, but they carry out tasks only on the node where the packages are running. All you need to do is build some if-statements into your crons.
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 10:46 AM
тАО09-10-2002 10:46 AM
Solutionsu oracle -c "crontab /u01/app/oracle/oracle"
where the file /u01/app/oracle/oracle contains the package specific cronjobs.
Additionally, in the package script under customer_defined_halt_cmds, we do:
> /tmp/nothing
su oracle -c "crontab /tmp/nothing"
You can modify the user to be whomever. USe the above as a guide.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 12:37 PM
тАО09-10-2002 12:37 PM
Re: MC/SG and cron jobs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 05:55 PM
тАО09-10-2002 05:55 PM
Re: MC/SG and cron jobs
You can bring up the cronjob of other user by root
i.e. su -
If you need to remove the cronjob of other user by root, you can type
crontab -r
Just make this statments in a startup and shutdown script and include them in the MC/SG package configuration file and it's OK
(/etc/cmcluster/
Regards,
Patrick
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 10:29 PM
тАО09-10-2002 10:29 PM
Re: MC/SG and cron jobs
Write a script for your crontab, that checks whether the package is running on the localhost. If this is true execute the cronjob, if not exit.
Look at the attachment.
Bye
Elif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-10-2002 11:51 PM
тАО09-10-2002 11:51 PM
Re: MC/SG and cron jobs
Rgds
Johan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2002 01:46 AM
тАО09-16-2002 01:46 AM
Re: MC/SG and cron jobs
Create a crontab section in a seperate file, put the file on all machine in your cluster and then add a script line to add the section at package startup and remove the section at package stop. Here some example:
Crontab section in seperate file:
=======================
##BEGIN:mysec
00 7 * * 1,2,3,4,5 /zaza.sh
##END:mysec
=======================
Here a line to remove this section from crontab:
=======================
crontab -l | /sbin/awk 'BEGIN { flag = 0 }{ if (($1 ~ /^##BEGIN:mysec/) && (flag == 0)) { flag = 1; }; if (flag != 1) { print; }; if
(($1 ~ /^##END:mysec/) && (flag == 1)) { flag = 0; } }' | crontab
=======================
Here a three lines to add the section in the crontab:
=======================
crontab -l > /tmp/crontab.zz.new
cat /tmp/crontab.zz.new mycron.sec | crontab
rm -f /tmp/crontab.zz.new
=======================
(mycron.sec is the crontab section).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2002 02:08 AM
тАО09-16-2002 02:08 AM
Re: MC/SG and cron jobs
The 2 recommendations have some issues: one crontab on each system where you do check package before ecxecuting the crontab entry means that you have to maintain two crontabs and they have to be the same.
When the crontab is activated during package start you can run into problems when the system crashes -> package fails over and crontab is started on standby host -> primary systems boots and start crontab -> result is that you have the same crontab runing on both systems.
What you can do about this is to add a script to the boot sequence that removes the crontab for the user involved. Also add a crontab -r to the stop script of the package in case of manual fail over.
This means that only one crontab is active on one machine at any time.
HtH,
Mark
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-16-2002 05:04 AM
тАО09-16-2002 05:04 AM