LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-01-2011, 04:44 PM   #1
chandkur
LQ Newbie
 
Registered: Feb 2011
Posts: 16

Rep: Reputation: 0
how to configure a crontask ?


My shell script in /home/ddmsuser/DDMSPurge/
in my crontab this is the first line

Home = /home/ddmsuser/download-data

Whatever shell scripts present under Home are configured in the crontab.

How to configure a crontask when my script is in /home/ddmsuser/DDMSPurge/ ?

Please help.

Last edited by chandkur; 03-01-2011 at 04:52 PM.
 
Old 03-01-2011, 05:07 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
This is a good reference -

http://corenominal.org/howto-setup-a-crontab-file/

When you configure crontab, you can use the full path to your script.

Josh
 
Old 03-01-2011, 05:12 PM   #3
chandkur
LQ Newbie
 
Registered: Feb 2011
Posts: 16

Original Poster
Rep: Reputation: 0
I have already tried doing that, but it fails to run as the class file it is supposed to execute is in another location.
 
Old 03-01-2011, 05:12 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
It's not clear exactly what you want to do.

I assume you want to add the script in /home/ddmsuser/DDMSPurge/ to your existing list of cron jobs.

If so, execute crontab -e from a terminal, and add this line:

Code:
* * * * * * /home/ddmsuser/DDMSPurge/scriptname
Replace the "* * * * * *" with how frequently you want the script to run (all *'s means to run the script once every minute--see man 5 crontab for specifics)

Replace the "scriptname" with the actual filename of your script.
 
Old 03-01-2011, 05:24 PM   #5
chandkur
LQ Newbie
 
Registered: Feb 2011
Posts: 16

Original Poster
Rep: Reputation: 0
I have already tried what you said.. and got this error ? any ideas what can be done, your help is appreciated


Quote:
From ddmsuser@wtxtt02.planet.ftn.fedex.com Tue Mar 1 17:20:01 2011
Return-Path: <ddmsuser@wtxtt02.planet.ftn.fedex.com>
Received: from wtxtt02.planet.ftn.fedex.com (localhost.localdomain [127.0.0.1])
by wtxtt02.planet.ftn.fedex.com (8.13.1/8.13.1) with ESMTP id p21MK1oU02 5108
for <ddmsuser@wtxtt02.planet.ftn.fedex.com>; Tue, 1 Mar 2011 17:20:01 -0 500
Received: (from ddmsuser@localhost)
by wtxtt02.planet.ftn.fedex.com (8.13.1/8.13.1/Submit) id p21MK1a6025107 ;
Tue, 1 Mar 2011 17:20:01 -0500
Date: Tue, 1 Mar 2011 17:20:01 -0500
Message-Id: <201103012220.p21MK1a6025107@wtxtt02.planet.ftn.fedex.com>
From: root@wtxtt02.planet.ftn.fedex.com (Cron Daemon)
To: ddmsuser@wtxtt02.planet.ftn.fedex.com
Subject: Cron <ddmsuser@WTXTT02> ./home/ddmsuser/DDMSPurge/runDDMSPurge.sh > ddm sPurge.out
Content-Type: text/plain; charset=UTF-8
X-Cron-Env: <HOME=/home/ddmsuser/download-data>
X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=ddmsuser>
X-Cron-Env: <USER=ddmsuser>

/bin/sh: ./home/ddmsuser/DDMSPurge/runDDMSPurge.sh: No such file or directory
 
Old 03-01-2011, 05:27 PM   #6
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 370Reputation: 370Reputation: 370Reputation: 370
Quote:
/bin/sh: ./home/ddmsuser/DDMSPurge/runDDMSPurge.sh: No such file or directory
Two things:
(1) verify that runDDMSPurge.sh is the exact filename of the script (i.e. proper capitalization of the script filename and the path to the script)
(2) I don't know why there is a dot (.) at the beginning of the path. Does the dot exist in the crontab? It shouldn't.
 
Old 03-01-2011, 05:29 PM   #7
chandkur
LQ Newbie
 
Registered: Feb 2011
Posts: 16

Original Poster
Rep: Reputation: 0
Hey thanks, I removed the dot and it seems to have kick started it.. no error mail in the spool.

The dot was there for the other jobs so I followed suit.

Thank you once again.
 
Old 03-01-2011, 08:41 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,241

Rep: Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325Reputation: 2325
A leading dot means start from the current dir. There's no such concept in cron, as all jobs run 'detached'. This is part of the reason you're usually advised to specify the complete absolute path to all cmds & files referenced in a cron job.
 
  


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




All times are GMT -5. The time now is 10:52 PM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration