LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
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 03-25-2009, 12:29 AM   #1
ust
Senior Member
 
Registered: Mar 2003
Location: fasdf
Distribution: Debian / Suse /RHEL
Posts: 1,129

Rep: Reputation: 30
Run script error


I have a script run on unix and linux server , I found that if run it at shell , it works fine , but if run on crontab job , it is not work , can advise what is the different to run on shell and crontab job ? how can I fix it ? thx


the script like below

!/bin/bash

if [ `date +%d` == 18 ]
then
xx

else
yy

fi
 
Old 03-25-2009, 01:23 AM   #2
your_shadow03
Senior Member
 
Registered: Jun 2008
Location: Germany
Distribution: Slackware
Posts: 1,434
Blog Entries: 6

Rep: Reputation: 51
Check the permission of the script.
What entry are you providing in the /etc/crontab entry?
 
Old 03-25-2009, 05:39 AM   #3
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,261

Rep: Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028Reputation: 2028
Depends what you mean by 'not work' ... details please.
In any case, the most likely issue is that cron doesn't have much of an environment (eg minimal $PATH), so all cmds should be referenced by their full names eg

/bin/date

instead of just 'date'
 
  


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


Similar Threads
Thread Thread Starter Forum Replies Last Post
run-parts gives error on bash script ChoKamir Programming 7 08-18-2014 06:31 AM
error when tying to run python script(bash error?) shanenin Programming 5 01-10-2006 10:01 AM
run script error ust Linux - Software 3 01-04-2006 03:56 AM
run script error ust Linux - Software 7 09-09-2004 08:44 AM
Script does not want to run, error rhuser Programming 15 03-06-2003 05:28 PM


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

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