LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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, 03: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 03:52 PM.
 
Old 03-01-2011, 04:07 PM   #2
corp769
LQ Guru
 
Registered: Apr 2005
Location: /dev/null
Posts: 5,818

Rep: Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007Reputation: 1007
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, 04: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, 04:12 PM   #4
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
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, 04: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, 04:27 PM   #6
Dark_Helmet
Senior Member
 
Registered: Jan 2003
Posts: 2,786

Rep: Reputation: 374Reputation: 374Reputation: 374Reputation: 374
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, 04: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, 07:41 PM   #8
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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



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



LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:16 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
Open Source Consulting | Domain Registration