UNIX Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsOperating SystemsUNIX Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old September 9th, 2005, 03:14 PM
tolldude tolldude is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 2 tolldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 37 sec
Reputation Power: 0
running a script in crontab

I need help. I'm trying to run a script to go out and get a file using ftp from to machines on my network daily. The script works fine when executed from the command line. However, I put it into the "crontab -e" (with the full path), I get and error of "unknown local host" .
Can anyone help me with this.


thanx

Reply With Quote
  #2  
Old September 11th, 2005, 07:15 AM
fpmurphy fpmurphy is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: USA
Posts: 259 fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level)fpmurphy User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 23 h 16 m 51 sec
Reputation Power: 6
Probably trying to mail error or output to you but either mail
is not set up on this system or it is encountering an error.

Reply With Quote
  #3  
Old September 12th, 2005, 08:49 AM
zlutovsky zlutovsky is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2004
Location: Prague, Czech Rep.
Posts: 117 zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level)zlutovsky User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 22 h 42 m 44 sec
Reputation Power: 6
Quote:
Originally Posted by tolldude
I need help. I'm trying to run a script to go out and get a file using ftp from to machines on my network daily. The script works fine when executed from the command line. However, I put it into the "crontab -e" (with the full path), I get and error of "unknown local host" .
Can anyone help me with this.


thanx


You have to ensure that the cron job is running in the same environment that your command line script has. Check the output of the env command both in the cron job and from the command line.

Regards

Reply With Quote
  #4  
Old September 12th, 2005, 09:49 AM
tolldude tolldude is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2005
Posts: 2 tolldude User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 37 sec
Reputation Power: 0
Quote:
Originally Posted by zlutovsky
You have to ensure that the cron job is running in the same environment that your command line script has. Check the output of the env command both in the cron job and from the command line.

Regards



If the env is different, how do i make the changes

Reply With Quote
  #5  
Old October 3rd, 2005, 07:57 PM
tj_nt tj_nt is offline
Contributing User
Dev Shed Intermediate (1500 - 1999 posts)
 
Join Date: Feb 2004
Posts: 1,608 tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level)tj_nt User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 1 Week 1 Day 14 h 51 m 4 sec
Reputation Power: 635
FWIW...


crontab -l (to see if a crontab exists in the same shell as the user)

to remove the current crontab :
crontab -r

to create a new crontab type:
crontab /path/to/crontab.txt

one problem with using a Windows system to compose scripts and crontabs is hidden characters that will prevent cron from executing a script...even though the script will run from bash...

Reply With Quote
  #6  
Old October 7th, 2005, 01:45 PM
playskool playskool is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Aug 2005
Posts: 48 playskool Negative: is most likely a SPAMMER and a traitor to the cause. 
Time spent in forums: 23 h 5 m 35 sec
Reputation Power: 0
type "echo $shell" to find what shell your running from prompt and force that shell in the first line of your script. Like !#/bin/sh.

cron runs in s stark environment so you need to set your envirmonment variables and/or use full paths.

Reply With Quote
Reply

Viewing: Dev Shed ForumsOperating SystemsUNIX Help > running a script in crontab


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway