LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 02-11-2011, 04:44 AM   #1
etika
Member
 
Registered: Dec 2010
Posts: 38

Rep: Reputation: 0
how to do scheduling using /etc/crontab file


hi

i want to do scheduling using /etc/crontab file instead of using crontab -e that is crontab command on the terminal.

i am appending to the crontab file in the /etc directory but the scheduling is not happening .

please help!!!!
 
Old 02-11-2011, 04:53 AM   #2
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Any specific reasons why you need to manually edit the crontab file and not use normal crontab -e option?
The crontab file has specific permissions and is not executable and is not readable by others. So if you are not a root, you will not be able to write the file and if you change the permissions, you are creating a security hole for yourself.
 
Old 02-22-2011, 07:49 PM   #3
etika
Member
 
Registered: Dec 2010
Posts: 38

Original Poster
Rep: Reputation: 0
hey
actually iam taking the 5 fields required for sheduling from the user from a jsp page in a textbox and then sending this parameter to my linux script (iam running my script in jsp page itself) and there in the script iam appending my cronjob like

echo"$1 user kk.sh">>/etc/cron.d/file
here $1 is the time field containing something like * * * * *
the files get appended but the
script is not getting scheduled
what's the error in the above
 
Old 02-22-2011, 08:01 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Quote:
Originally Posted by etika View Post
echo"$1 user kk.sh">>/etc/cron.d/file
... but the script is not getting scheduled
what's the error in the above

The lack of a path to the script.
 
Old 02-22-2011, 09:12 PM   #5
etika
Member
 
Registered: Dec 2010
Posts: 38

Original Poster
Rep: Reputation: 0
no its not that problem
by mistake i wrote that

even if i write full path of the script there it doesn't work

problem lies somewhere else and i don't know where it is ......
 
Old 02-22-2011, 09:16 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.8, Centos 5.10
Posts: 17,240

Rep: Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324Reputation: 2324
The default cron env is minimal. The usual rule-of-thumb is to specify the complete absolute path to all cmds & files referenced by jobs run from cron, or source a file containing the reqd env settings.
Also, if cron has problems, it will email the job owner or root with problem details.
You can access this by using the mail or mailx cmd from the cmd line as the job owner or root.
HTH
 
Old 02-23-2011, 01:49 AM   #7
linuxlover.chaitanya
Senior Member
 
Registered: Apr 2008
Location: Nagpur, India
Distribution: Cent OS 5/6, Ubuntu Server 10.04
Posts: 4,629

Rep: Reputation: Disabled
Why not check yourself for logs if the cron jobs are executing or not. Also check if the cron is executing in the first place and that cron daemon is running.
 
Old 02-25-2011, 11:10 PM   #8
etika
Member
 
Registered: Dec 2010
Posts: 38

Original Poster
Rep: Reputation: 0
ok thanks
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem In Scheduling with Crontab on RHEL 4 Raghu140 Linux - Newbie 4 10-23-2009 03:34 AM
How to send a html file as an file attachment to my mail from crontab? GRD Linux - Newbie 2 06-03-2008 12:39 PM
How to write crontab to check file size and all file in a directory? modpriest Linux - Newbie 1 02-14-2008 07:48 AM
LXer: Scheduling Backup Jobs using at and crontab LXer Syndicated Linux News 0 04-22-2006 02:24 AM
CRONTAB file scottpioso Linux - General 14 11-29-2003 02:38 PM


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