LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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 05-08-2008, 04:31 AM   #1
panselva
LQ Newbie
 
Registered: May 2008
Posts: 1

Rep: Reputation: 0
Smile how to run crontab in shell script


hi! I would like to know how to run crontab in shell script.
pls help me
 
Old 05-08-2008, 05:27 AM   #2
Simon Bridge
Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 197Reputation: 197
You don't. What are you trying to achieve?
 
Old 05-08-2008, 05:42 AM   #3
unSpawn
Moderator
 
Registered: May 2001
Posts: 27,019
Blog Entries: 54

Rep: Reputation: 2766Reputation: 2766Reputation: 2766Reputation: 2766Reputation: 2766Reputation: 2766Reputation: 2766Reputation: 2766Reputation: 2766Reputation: 2766Reputation: 2766
Moved: This thread is more suitable in Linux General forum and has been moved accordingly to help your thread/question get the exposure it deserves.


Quote:
Originally Posted by Simon Bridge View Post
You don't.
Why not?


Quote:
Originally Posted by panselva View Post
I would like to know how to run crontab in shell script.
Hello and welcome to LQ. Next time please post what you've tried, that makes it easier for us to see how to guide you. Editing a users crontab is easy but requires some steps: 0) list the crontab and output to a temporary file, 1) append the lines you need to the temporary file, 2) run 'crontab temporaryfilename' to make changes stick. You can find the crontab commands in 'man 1 crontab'.
 
Old 05-08-2008, 08:33 PM   #4
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.5, Centos 5.10
Posts: 16,251

Rep: Reputation: 2026Reputation: 2026Reputation: 2026Reputation: 2026Reputation: 2026Reputation: 2026Reputation: 2026Reputation: 2026Reputation: 2026Reputation: 2026Reputation: 2026
As per SB, I'd ask what the OP actually wants to do.
Sounds like he wants to run a cmd from his crontab at the cmd line, which would just be a copy-paste, ignoring the timing string.
To change a crontab, just use
crontab -e
as the relevant user. No need to mess with temp files etc.
 
  


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
my database export shell script run from command line but not form crontab saifee Linux - General 11 01-29-2012 09:24 AM
crontab job and run on shell sunhui Linux - Software 1 02-13-2007 05:35 AM
Script doesn't run in crontab dani81 Linux - General 1 11-16-2004 03:42 AM
Shell script running via crontab problem. thetruethugg Linux - Software 13 12-19-2003 08:56 PM
adding a job to crontab via shell script tazio Linux - General 7 10-23-2003 02:44 PM


All times are GMT -5. The time now is 07:57 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration