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 02-01-2010, 09:28 AM   #1
epamuk
Member
 
Registered: May 2007
Posts: 62

Rep: Reputation: 15
Why this crontab dont run?


Hi,

I want to run a crontab job but it isnt working. I am writing in the crontab file with crontab -e Then I am waiting time but it isnt working.

Code:
15 17  * * * ./home/admin/backup_sc
Command running on the terminal window When I try to run this command (./home/admin/backup_sc) and I see it is running but it isnt working when I write to crontab file.

you can see crontab file at below.

Why it isnt running?

Quote:
Expert@test]# crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.5348 installed on Mon Feb 1 17:13:59 2010)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
15 17 * * * ./home/admin/backup_sc
 
Old 02-01-2010, 09:38 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,

It probably is running (trying to run, to be more specific).

Crontab doesn't have a full set of environment settings (opposed to a "normal" shell). If your script relies on any environment setting, it probably won't run from cron.

Post your script so we at LQ can have a look and point you in the right direction.
 
Old 02-01-2010, 09:44 AM   #3
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
"./home/admin", you're using a relative path, which is a really daft idea, and secondly you're assuming this relative position is "/" Which is never going to be the case. I *think* you just didn't want to put the . there in the first place.
 
Old 02-01-2010, 09:56 AM   #4
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
@epamuk: Try acid_kewpie's suggestion first, it is more probable then my suggestion (I missed it to be honest...).
 
Old 02-04-2010, 12:48 AM   #5
epamuk
Member
 
Registered: May 2007
Posts: 62

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by acid_kewpie View Post
"./home/admin", you're using a relative path, which is a really daft idea, and secondly you're assuming this relative position is "/" Which is never going to be the case. I *think* you just didn't want to put the . there in the first place.
Hi acid_kewpie and druuna,

We try as /sbin/backup_sc but it isnt still working.

you can see crontab details and you can see script content.

I didnt understand, why this crontab isnt working?

Code:
[Expert@test_cpng]# crontab -l
# DO NOT EDIT THIS FILE - edit the master and reinstall.
# (/tmp/crontab.5256 installed on Tue Feb  2 17:45:07 2010)
# (Cron version -- $Id: crontab.c,v 2.13 1994/01/17 03:20:37 vixie Exp $)
20 8 * * * /sbin/backup_sc
Code:
[Expert@test_cpng]# cat /sbin/backup_sc 
st=/opt/CPshrd-R70/bin/cpstop
CMD=/opt/CPsuite-R70/fw1/bin/upgrade_tools/upgrade_export
BKPDIR=/var/fwbackup/
FILE="FW-`/bin/date '+%d-%m-%Y'`_ogle"
$st 
echo "\n" | $CMD ${BKPDIR}${FILE}
/opt/CPshrd-R70/bin/cpstart

Code:
[Expert@test_cpng]# ls -al backup_sc
-rwxrwx---    1 root     root          216 Feb  1 17:19 backup_sc

script file under the /sbin folder.
 
Old 02-04-2010, 01:33 AM   #6
Disillusionist
Senior Member
 
Registered: Aug 2004
Location: England
Distribution: Ubuntu
Posts: 1,039

Rep: Reputation: 98
cronjob scheduled for 08:20 every morning...

Can you check root's mail?

cron will send a mail to root containing output from root's cron jobs (including STDERR messages). This will most likely help with troubleshooting the problem.
 
Old 02-04-2010, 01:36 AM   #7
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
well you're not running it as root, which seems odd. Backups are system level operations, therefore should be executed at that level, via the /etc/crontab not by a user accounts crontab. Does this other user have rights to put files there?
 
  


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
[SOLVED] Difference between manual run and crontab run? EnderX Linux - Newbie 3 01-15-2010 03:46 PM
[SOLVED] crontab didn't run qwertyjjj Linux - Newbie 28 08-14-2009 07:04 AM
run from USB (dont need to boot / just to run) stu7 Linux - Hardware 2 04-06-2008 01:06 PM
Cannot get crontab to run uncle-c Linux - Newbie 4 02-12-2008 06:05 AM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 03:42 AM

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

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