Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
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!


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

Rep: Reputation: Disabled
crontab issue


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, 04:30 AM   #2
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,075

Rep: Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433Reputation: 1433

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).

Old 10-30-2014, 08:46 AM   #3
LQ Guru
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 15,613

Rep: Reputation: 5120Reputation: 5120Reputation: 5120Reputation: 5120Reputation: 5120Reputation: 5120Reputation: 5120Reputation: 5120Reputation: 5120Reputation: 5120Reputation: 5120
you ought to use full path in your script, something like:
1 members found this post helpful.
Old 10-30-2014, 09:44 AM   #4
Senior Member
Registered: Dec 2005
Location: Florida
Distribution: CentOS/Fedora/Pop!_OS
Posts: 2,855

Rep: Reputation: 545Reputation: 545Reputation: 545Reputation: 545Reputation: 545Reputation: 545
post the script in code blocks, but odds are you are not using the full path for the commands.
Old 10-30-2014, 10:50 AM   #5
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.


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 03:34 PM
[SOLVED] Crontab Issue shii_va Linux - Server 2 09-15-2009 12:30 PM
crontab issue adnanm Linux - Newbie 1 03-16-2007 03:28 AM
crontab issue houssamfarag Red Hat 2 06-28-2006 12:56 AM
crontab issue lappen Linux - Newbie 6 05-24-2004 06:47 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 04:22 AM.

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