LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-20-2006, 02:44 PM   #1
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Rep: Reputation: 30
Messing with crontab


I need to modify crontab through a script, but I've read that if I modify the file directly, cron won't pick up the changes.

Has anyone managed to write a cron file directly and for the changes to work? If so any tips?

Thanks
 
Old 04-20-2006, 03:09 PM   #2
draxen
Member
 
Registered: Nov 2004
Posts: 43

Rep: Reputation: 15
Re: crontab

1) run "crontab -l > tempcrontab"
2) edit your tempcrontab
3) run "crontab tempcrontab"
 
Old 04-20-2006, 03:12 PM   #3
ataraxia
Member
 
Registered: Apr 2006
Location: Pittsburgh
Distribution: Debian Sid AMD64
Posts: 296

Rep: Reputation: 30
Or, just do
Code:
crontab -e
Edit: Didn't notice the "script" part.

Last edited by ataraxia; 04-21-2006 at 08:48 PM.
 
Old 04-21-2006, 09:20 AM   #4
bigearsbilly
Senior Member
 
Registered: Mar 2004
Location: england
Distribution: Mint, Armbian, NetBSD, Puppy, Raspbian
Posts: 3,515

Rep: Reputation: 239Reputation: 239Reputation: 239
why are you trying to modify crontab through a script?
don't do it, bad medicine.
why not use 'at' or 'batch' ?
 
Old 04-22-2006, 04:41 AM   #5
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Original Poster
Rep: Reputation: 30
Thanks for the replies so far, I'm making progress. The system I'm working on is for an intranet only, so I'm not too worried about security for now. I want the user to change some stuff on cron through a web interface, so that the box will run the jobs on booting only, i.e. no user logged in.

If I'm correct, then cron needs to be modified by root. If that's not correct, then let me know, as I'm running into some problems. My script to modify cron works when I call it from root, but when I call it from the web interface it tries to modify cron for 'nobody'. So that won't run on boot? I tried to modify for root, by 'su', but I get the error:

su: must be run from a terminal

So now I'm stuck. If cron for nobody runs at boot, then no problem. Can anyone please enlighten me.

Thanks

Last edited by nutthick; 04-22-2006 at 04:42 AM.
 
Old 04-22-2006, 06:42 AM   #6
nutthick
Member
 
Registered: Jun 2004
Distribution: Slack
Posts: 214

Original Poster
Rep: Reputation: 30
Well they say a little knowledge is dangerous. crontab as nobody will run on boot. So all my script stuff is as nobody and it's working great.
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
firefox is messing with me Chapin Linux - Newbie 3 02-03-2005 02:40 AM
Messing with NTFS dinkydarko Linux - Newbie 9 11-23-2004 10:21 AM
system-wide crontab in /etc/crontab ner Linux - General 2 11-18-2003 12:35 PM
X is messing with me, or something is... Starchild Linux - General 2 09-27-2003 02:44 PM
RH keeps messing up...:( floyes Red Hat 4 09-06-2003 02:36 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

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