LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-22-2004, 06:13 AM   #1
sanjith11
Member
 
Registered: Oct 2003
Distribution: redhat
Posts: 63

Rep: Reputation: 15
Unhappy script not running as a cron job


Hello all,

a shell script which i have made for some automation works when i run it manually. but the same script dosent work as a cron job.

Does any one out there have any idea why it is like this.


the script basically runs prebuilt scripts owned by diffrent users( call's 1 by 1)

thanks
SaN
 
Old 11-22-2004, 07:16 AM   #2
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
Try set the PATH with directory where your prebuilt scripts are located in crontab. Did you check
your mail to see the logged errors ?

crontab -e example :
Code:
# you could put env variables here
PATH=$PATH:/home/user/bin:/home/bill/bin:/home/sanjith11/scripts

# cron
30  20  *   *   *   /path/to/script
 
Old 11-23-2004, 06:13 AM   #3
sanjith11
Member
 
Registered: Oct 2003
Distribution: redhat
Posts: 63

Original Poster
Rep: Reputation: 15
Is there any way to emulate the cron behaviour from the shell itself , so that i can test the script easily without waiting for the cron job to happen.
 
Old 11-23-2004, 06:19 AM   #4
Cedrik
Senior Member
 
Registered: Jul 2004
Distribution: Slackware
Posts: 2,140

Rep: Reputation: 244Reputation: 244Reputation: 244
To test your cron you could try :

- on a terminal, type : tty, note the result
- set a cron as this, say your tty is /dev/pts/1 :

* * * * * date >> /dev/pts/1

Now look at your terminal how things go
 
Old 11-23-2004, 08:27 AM   #5
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Ubuntu/WSL
Posts: 9,788

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
or better:
Code:
* * * * * date > /dev/pts/1 2>/dev/pts/1
 
Old 11-23-2004, 08:42 AM   #6
dawharl
LQ Newbie
 
Registered: Sep 2004
Distribution: debian, gentoo, red hat
Posts: 16

Rep: Reputation: 0
I had a similar problem, but I fixed it:

It was because I ran some other scripts, from the script.
These were not working, because I did not include the full path.

Maybe you're having similar problems, try including full path's to the executables in the script, it might work.

It did for me
 
  


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
Cron Job with a Script bravored Linux - General 4 08-05-2005 10:27 AM
Cron Job not running ssh script karim0028 Linux - General 3 02-07-2005 12:08 PM
cron job not running vincebs Linux - Software 34 10-30-2004 01:27 PM
Cron job not running? james_cwy Linux - Newbie 6 12-14-2003 08:24 PM
Cron Job Not Running pzorn Linux - General 4 10-02-2003 01:38 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 03:55 AM.

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