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 > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
cron job question dannyd Linux 5 03-03-2008 11:40 AM
cron question moe2266 Shell Programming and Scripting 4 11-19-2007 02:08 AM
cron question moe2266 Shell Programming and Scripting 4 08-20-2007 03:09 PM
CRON Question DenD AIX 2 01-17-2006 01:59 PM
cron question ted Shell Programming and Scripting 2 08-02-2004 04:13 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 12-08-2006
hcclnoodles hcclnoodles is offline
Registered User
  
 

Join Date: Mar 2002
Posts: 272
question about cron

I have a script which goes out and installs a package on a box remotely and im trying to get it to add a cron job too..but im having a few problems, whilst it does add the entry it wont run unless I connect to the machine , crontab -e, then :wq. This re-reads the configuration file and it will now run. so i tried in my script the following methods

1) I tried to edit the cron file for root directly

Code:
ssh $mybox 'echo "0 22 * * 5 /opt/SUNWexplo/bin/explorer -q -e" >> /var/spool/cron/crontabs/root'
But i realised that the process would need to be HUP'ed to re-read this conf file so i tried adding

Code:
pkill -HUP cron
I come in the next morning and I check /var/cron/log and nothing has run. However, as i said, if i crontab -e and then save it immediately (:wq) then it will work fine



2) Ok, as far as im aware the above should have worked but I thought id try another method, this according to my colleague would definately work. Output crontab -l to a temp file , append the line to the temp file and use crontab <filename>. to re-read it in...
Code:
ssh $mybox 'crontab -l > /tmp/cron1'
ssh $mybox 'echo "0 22 * * 5 /opt/SUNWexplo/bin/explorer -q -e" >> /tmp/cron1'
ssh $mybox 'crontab /tmp/cron1'
Same thing, come in next morning nothings happened, log onto box crontab -e, then immediately same it (:wq) and all is working ..

Does anybody have any idea on how i can get this to work

cheers
  #2 (permalink)  
Old 12-08-2006
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,116
Try changing the last line to:

ssh $mybox 'crontab < /tmp/cron1'

If this really does not work, your crontab must be broken. You could kill cron, modify the true crontab and restart cron.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 02:30 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0