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 05-15-2010, 04:29 AM   #1
LQ Newbie
Registered: May 2010
Location: New Delhi, India
Posts: 1

Rep: Reputation: 0
Question return value of tftp is always zero in cronjob

I have called an script in cronjob named as follows:

MAC=`ifconfig eth0 |sed -n 1p|awk '{print $5}'|awk -F : '{print $1$2$3$4$5$6}'`
tftp -l $MAC.params -r $MAC.cfg -g $Server
if [ -s $MAC.params ]; then
echo "File downloaded successfully"
cat /etc/config/crontab|sed '/'>crontab.bak
mv crontab.bak /etc/config/crontab
/etc/init.d/ > /etc/asterisk/scripts/phone.params
/etc/init.d/ > /etc/asterisk/sip.conf
/etc/init.d/ > /etc/asterisk/users.conf
rm $MAC.params
echo "No or an empty file exists."

But the problem is that the return value of tftp command is always zero and the if condition is always true. That's why i'm not getting the desired output.

Can anyone help me on this.

Thank You.........

Last edited by ajiteshsagar; 05-17-2010 at 07:27 AM.
Old 05-15-2010, 02:24 PM   #2
LQ 5k Club
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,398
Blog Entries: 2

Rep: Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908Reputation: 908
It is quite possible, in fact likely, that your script does not run either ifconfig, or tftp, since you have not provided any $PATH with which to find it. Processes launched by cron do not have the same environment as those run from an interactive shell. The solution may be as simple as specifying the full path to the runtime binaries. If the script runs correctly from an interactive shell, then I would be even more certain that this is at least part of the problem.
--- rod.



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
in.tftp pxelinux.0_ fails with TFTP open timeout deadeyes Linux - Server 1 05-28-2010 11:07 AM
dpkg return error :post installation script return an error code (1) grimfold Debian 2 09-10-2009 02:55 PM
after re-create tftp dir, tftp doesn't work anymore lastguy Linux - Networking 2 11-16-2007 04:33 PM
tftp issue, unable to transfer kernel image using tftp to boot ltsp-client noobs4linux Linux - Networking 1 02-07-2007 02:53 AM
TFTP-Problem: TFTP timed out Bikerpete Linux - General 2 08-14-2003 06:25 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:52 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration