LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 10-30-2014, 03:20 AM   #1
shaykoh
LQ Newbie
 
Registered: Oct 2014
Posts: 1

Rep: Reputation: Disabled
crontab issue


hi,


I wrote a small simple script which writes the arp table of the machine and transfer it to a tftp server the script is running great when i run it manually but when i try to run it via crontab i get an epmty file the empty file created on the local machine

here is the script:

arp -a > arp_table.txt
tftp x.x.x.x -c put arp_table.txt
 
Old 10-30-2014, 03:30 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
Hi,

does the script work as expect when you run it manually?

Problems with scripts not executing as you expect with cron are often caused by the limited environment. Eg the PATH is set differently.

Did you check for error messages from cron? Eg in /var/log/syslog (exact location depends on your system, which you did not describe).

Evo2.
 
Old 10-30-2014, 07:46 AM   #3
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,842

Rep: Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308Reputation: 7308
you ought to use full path in your script, something like:
/sbin/arp
/usr/bin/tftp
 
1 members found this post helpful.
Old 10-30-2014, 08:44 AM   #4
lleb
Senior Member
 
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,983

Rep: Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551Reputation: 551
post the script in code blocks, but odds are you are not using the full path for the commands.
 
Old 10-30-2014, 09:50 AM   #5
YankeePride13
Member
 
Registered: Aug 2012
Distribution: Ubuntu 10.04, CentOS 6.3, Windows 7
Posts: 262

Rep: Reputation: 55
Provide the full paths to all of the binaries used in your script. This is likely causing you grief. One easy way to tell what's going on is to redirect stdout and stderr to a log file. This will show you the errors.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
One issue with Crontab abhitanshu Linux - Server 3 09-24-2012 02:34 PM
[SOLVED] Crontab Issue shii_va Linux - Server 2 09-15-2009 11:30 AM
crontab issue adnanm Linux - Newbie 1 03-16-2007 02:28 AM
crontab issue houssamfarag Red Hat 2 06-27-2006 11:56 PM
crontab issue lappen Linux - Newbie 6 05-24-2004 05:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:50 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration