LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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,130

Rep: Reputation: 31
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,466
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
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,362

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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



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 9 04-11-2017 07:18 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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:42 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration