LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop
User Name
Password
Linux - Desktop This forum is for the discussion of all Linux Software used in a desktop context.

Notices


Reply
  Search this Thread
Old 05-23-2007, 03:32 PM   #1
shelb
LQ Newbie
 
Registered: May 2007
Location: New Zealand
Posts: 3

Rep: Reputation: 0
Cron wont run my shell script


Hi,

I have a shell script that runs fine manually, but wont run if I try to schedule using cron or Kcron. I would like to have it run every day at 5.30pm.

by command line it runs using
$sh bkup.sh

using cron as su I have
30 17 * * 1,2,3,4,5 /bin/sh /data/archive.sh

I have read through several posts on this and I have tried not renaming the file so it doesn't have the .sh extension, and I have checked that the permission are executable.

We are using redhat enterprise edition

Strangely I have another task scheduled that clears the contents of a folder once a week. This one works, but not every week!
0 23 * * 7 /bin/rm /data/temp/

So question is am I setting it up wrong and if not why doesn't it work? I'm kinda new to linux, so please let me know if there is a better way to schedule this task
 
Old 05-23-2007, 03:51 PM   #2
0.o
Member
 
Registered: May 2004
Location: Raleigh, NC
Distribution: Debian, Solaris, HP-UX, AIX
Posts: 208

Rep: Reputation: 35
Quote:
Originally Posted by shelb
Hi,

I have a shell script that runs fine manually, but wont run if I try to schedule using cron or Kcron. I would like to have it run every day at 5.30pm.

by command line it runs using
$sh bkup.sh

using cron as su I have
30 17 * * 1,2,3,4,5 /bin/sh /data/archive.sh

I have read through several posts on this and I have tried not renaming the file so it doesn't have the .sh extension, and I have checked that the permission are executable.

We are using redhat enterprise edition

Strangely I have another task scheduled that clears the contents of a folder once a week. This one works, but not every week!
0 23 * * 7 /bin/rm /data/temp/

So question is am I setting it up wrong and if not why doesn't it work? I'm kinda new to linux, so please let me know if there is a better way to schedule this task
29 5 * * * /bin/sh /data/archive.sh

0 23 * * 6 /bin/rm /data/temp

The first will run @ 5:30PM every day.

The second will run @ 11PM on Sunday.

Someone correct me if i am wrong, please.
 
Old 05-23-2007, 03:57 PM   #3
shelb
LQ Newbie
 
Registered: May 2007
Location: New Zealand
Posts: 3

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by 0.o
29 5 * * * /bin/sh /data/archive.sh

0 23 * * 6 /bin/rm /data/temp

The first will run @ 5:30PM every day.

The second will run @ 11PM on Sunday.

Someone correct me if i am wrong, please.

Oh sorry typo on my part, I have the remove directory entry set to 6! Any ideas why it works some weeks and not others?
 
Old 05-27-2007, 09:52 PM   #4
ADxD_7
Member
 
Registered: May 2007
Location: CO
Distribution: Solaris , Redhat , Debian
Posts: 152

Rep: Reputation: 23
Hey someone had that problem here on their solaris box, I fixed it by restarting the cron daemon. I dont know if this helps but you could give it a try.
 
Old 05-27-2007, 09:55 PM   #5
shelb
LQ Newbie
 
Registered: May 2007
Location: New Zealand
Posts: 3

Original Poster
Rep: Reputation: 0
Tried that! But no joy.
 
  


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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
Cron restart script wont work! ThaHabbis Linux - General 3 03-16-2007 04:38 AM
script doesn't run in cron (runs from shell just fine) Timur Sakayev Linux - Software 6 02-26-2007 12:56 PM
run shell script on cron varunbihani Linux - Newbie 5 07-08-2005 01:50 AM
shell script fo run auto job in cron JolynnMarie LinuxQuestions.org Member Intro 0 04-28-2004 11:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Desktop

All times are GMT -5. The time now is 12:13 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