LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   crontab issue (https://www.linuxquestions.org/questions/linux-newbie-8/crontab-issue-4175523765/)

shaykoh 10-30-2014 03:20 AM

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

evo2 10-30-2014 03:30 AM

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.

pan64 10-30-2014 07:46 AM

you ought to use full path in your script, something like:
/sbin/arp
/usr/bin/tftp

lleb 10-30-2014 08:44 AM

post the script in code blocks, but odds are you are not using the full path for the commands.

YankeePride13 10-30-2014 09:50 AM

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.


All times are GMT -5. The time now is 01:00 PM.