LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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 10-24-2006, 08:28 PM   #1
jonfa
Member
 
Registered: Mar 2001
Location: FL
Posts: 257

Rep: Reputation: 30
cron execute problems


Hi All,

I am running Centos 4.4 and I am having problems getting cron to run my script. I have made a script (usbback.sh) that is as follows:

#! /bin/sh
\cp -fR /data /media/usbback/
exit 0

The script runs just fine from the command line. If I make the following entry using crontab -e:

30 * * * * /root/scripts/usbback.sh

It will not run. The permissions on usbback.sh is 744. Any ideas why it won't run? Thanks.
 
Old 10-25-2006, 03:57 AM   #2
druuna
LQ Veteran
 
Registered: Sep 2003
Posts: 10,532
Blog Entries: 7

Rep: Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405Reputation: 2405
Hi,

The first line should be #!/bin/sh (there should be no space between #! and /bin...).

Why is there a backslash before the cp command (\cp -fR....)?

Hope this helps.
 
Old 10-25-2006, 04:53 AM   #3
Lotharster
Member
 
Registered: Nov 2005
Posts: 144

Rep: Reputation: 18
I had a similar problem trying to run a cron script. I set the execute time to 12:00 and then set my KDE time to 11:59:50. Then I waited for my script to execute but id didn't.

The problem was that setting the KDE clock only sets KDE time, not system time. You need date to set it (and root privileges).
 
  


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 On
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 job to execute automatically lifegamer Linux - Newbie 2 09-16-2006 08:35 AM
Cannot execute rsync as a cron job jdaniels73 Linux - Software 2 09-03-2006 05:03 AM
cron jobs dont execute.. :( logicalfuzz Linux - Software 1 02-24-2006 05:43 AM
CRON Process Won't Execute Automatically Transition Linux - General 5 01-14-2005 03:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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