LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Suse/Novell
User Name
Password
Suse/Novell This Forum is for the discussion of Suse Linux.

Notices

Reply
 
LinkBack Search this Thread
Old 07-16-2008, 10:03 AM   #1
pramka
Member
 
Registered: May 2007
Location: ny
Distribution: fedora
Posts: 33

Rep: Reputation: 15
Command would not execute within a script


Hi,
I wrote a script to display disk-quotas. It works fine if I execute it manually. However when I execute it from cron it says ...
"repquota: command not found"
day=`date +%a`
if [[ $day == "Sat" || $day = "Sun" ]]
then
echo Weekend job will not execute
fi
if [ $day == "Wed" ]
then
repquota -av > /var/log/quota.log
repquota -avg >> /var/log/quota.log
else
echo Job not scheduled for today
fi
mailx -s "Result of Quotacheck" root@localhost << EOT
"`cat /var/log/quota.log`"
EOT
Also there is no display in the body of the mail only ... ""
 
Old 07-16-2008, 10:10 AM   #2
csinclair
LQ Newbie
 
Registered: Nov 2006
Location: Canada
Distribution: Slackware 11, DSL (Debian), Ubuntu 8.04 (Hardy Heron), Smoothwall, Ophcrack & BackTrack2
Posts: 21

Rep: Reputation: 15
repquota path info..

Try putting the full path to the executable repquota in the cron script, it's probably unable to find it's parent directory in the $PATH variable.

Craig
 
Old 07-16-2008, 10:11 AM   #3
gparrish
LQ Newbie
 
Registered: Apr 2006
Posts: 13

Rep: Reputation: 0
The problem is the environment. It can not find the script due to the $PATH. Basically it does not know where the script lives. Add to the script a "env" or "set" statement and dump that to a file and you can compare that env to your environment from your shell/CLI.

The likely fix will be to just specify the full path to the script or to add a path statement to the top of the script. You many need to export the path also but some basic testing will let you know if that is needed.
 
  


Reply


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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to execute Source command in a shell script UltraSoul Linux - General 3 09-23-2010 10:13 AM
Execute command with spaces from variable in bash script klo_2k Linux - Newbie 4 04-13-2008 02:59 AM
Execute a windows command from inside a c-cgi-script leamassiot General 51 02-09-2006 10:06 AM
How to execute a command line in a shell script orgazmo Programming 5 05-09-2005 09:16 AM
boot script execute command as non-root user wampfler Linux - Security 7 09-24-2004 04:56 AM


All times are GMT -5. The time now is 08:27 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration