- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- adding entry in cron
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
Forums
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
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
тАО10-07-2008 07:57 AM
тАО10-07-2008 07:57 AM
adding entry in cron
I need to add a cronjob. Now I need to add this to over 600 servers.It would be difficult to login on each and every server and do a crontab -e and add the job.Do we have suggestion to append this new job on all the servers.
- Tags:
- crontab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2008 08:03 AM
тАО10-07-2008 08:03 AM
Re: adding entry in cron
It should be a relatively simple matter to set up a script that would echo the new entry, appending it to the various machine's crontabs. Something like this:
echo "00 05 * * 1 /opt/ignite/bin/check_recovery" >> /var/spool/cron/crontabs/root
would do it. Then you just need to figure out how to do that on all your servers. Maybe a "for" loop?
for SRVR in `cat server_list`
do
echo command here
done
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2008 08:09 AM
тАО10-07-2008 08:09 AM
Re: adding entry in cron
You could 'ssh' or 'rsh' into your servers and then do (for example):
# echo "* * * * * date" >> /var/spool/cron/crontabs/root
# /sbin/init.d/cron stop
# /sbin/init.d/cron start
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2008 08:12 AM
тАО10-07-2008 08:12 AM
Re: adding entry in cron
Multiplying error on 600 server will cost you lots of time.
First test your script on 1-2 server.
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2008 08:25 AM
тАО10-07-2008 08:25 AM
Re: adding entry in cron
>It should be a relatively simple matter to set up a script that would echo the new entry, appending it to the various machine's crontabs.
Do NOT do this! cron has no idea you did this so it will NOT see the new entry.
A better solution would be to use "crontab -l", then your echo, then "crontab file" to reread the new file.
>for SRVR in `cat server_list`
And of course you remove evil cats by:
for SRVR in $(< server_list); do
>JRF: # /sbin/init.d/cron stop
That would be better but why not do the obvious and use crontab?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-07-2008 08:26 AM
тАО10-07-2008 08:26 AM
Re: adding entry in cron
I'm sorry, what in our answers didn't satisfactorily answer your question?
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-08-2008 01:20 AM
тАО10-08-2008 01:20 AM
Re: adding entry in cron
perhaps a summary of all of the valuable answer will help Kwhite ...
NB1: a plain 'remsh' command will read from stdin and that may have 'mysterious' impact for loops triggered by stdin ...
NB2: I'd keep the temporary files as a backup of the previous crontab entry.
rem=ssh # or rem=remsh
for svr in ($
print 'MM HH DD . . . cronentry' |
$rem $svr '(crontab -l >/tmp/crt); cat /tmp/crt - | crontab'
done
mfG Peter