LinuxQuestions.org
LinuxAnswers - the LQ Linux tutorial section.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 05-23-2011, 12:42 AM   #1
Lossenelin
Member
 
Registered: Sep 2002
Location: New Zealand
Distribution: Ubuntu 10.10
Posts: 38

Rep: Reputation: 15
Question Scheduled Tasks / Cron not working right?


Got a small problem, I'm trying to schedule a script to run every Thursday at midday and the scheduled tasks application on Ubuntu doesn't seem to work. The script is fine when I run it from a terminal.

I have zero experience using cron at the command line, can anyone tell me what I should do?
 
Old 05-23-2011, 01:15 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,394

Rep: Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963Reputation: 1963
well you could start by showing us the cron entry... How can we fix it without knowing what it is?

for a user crontab an example would be...

0 12 * * 4 /bin/sh /home/user/myscript.sh

i.e at 12:00 on the 4th day of the week run this script.

Last edited by acid_kewpie; 05-23-2011 at 01:17 AM.
 
Old 05-23-2011, 10:02 PM   #3
speck
Member
 
Registered: Nov 2001
Location: California
Distribution: Slackware 14.1
Posts: 272

Rep: Reputation: 54
The vast majority of these types of issues are caused by not specifying the full path to the programs inside the script. Cron does not run under the same environment as a normal user, so you should explicitly state the path to every script/program that is being executed.

Incorrect:
Code:
#!/bin/sh
clean_files /tmp /var/log/setup/tmp
Correct:
Code:
#!bin/sh
/usr/local/bin/clean_files /tmp /var/log/setup/tmp
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
how can tasks be scheduled on two cpus? archieval Programming 8 06-12-2008 12:11 AM
Scheduled tasks gubak Linux - Newbie 3 04-24-2007 02:34 AM
Cron - doesn't seem to run scheduled tasks robintw Linux - General 11 11-25-2005 01:53 AM
Scheduled tasks? onionkn1ght Linux - Software 3 01-11-2005 10:20 PM
Scheduled tasks... beserier Linux - General 1 01-24-2003 08:55 AM


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