LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 04-05-2004, 12:22 PM   #1
Bake-SaleNet
LQ Newbie
 
Registered: Jul 2003
Posts: 15

Rep: Reputation: 0
adding new cron job via web


I've got a script on my site which schedules the release of content for a future date:

part1 takes the date and time to be released

part2 builds a line for a new crontab entry

part3 is the script which releases the content at said date.

Everything but part2 is working great, having ran it several times through the command line without incident, but how do I go about inserting a new crontab entry?

thanks

scot

[edit] cron insertion is via the web...

Last edited by Bake-SaleNet; 04-06-2004 at 11:11 PM.
 
Old 04-06-2004, 11:10 PM   #2
Bake-SaleNet
LQ Newbie
 
Registered: Jul 2003
Posts: 15

Original Poster
Rep: Reputation: 0
nobody? no one at all? heh oh man. looks like im all alone on this one....
 
Old 04-07-2004, 04:19 AM   #3
QuakerJ
LQ Newbie
 
Registered: Mar 2004
Location: Nottingham, UK
Distribution: Fedora14 - Gnome2
Posts: 15

Rep: Reputation: 0
The description you give makes me think that an 'at' job would be more what you want. Cron jobs are for repeated jobs at specified fixed times. But at or cron would be extremely insecure. Initiating an at or cron job on your web server remotely from a client would be as dangerous allowing clients shell access to your server.
Presumably your web server is running as apache or nobody (not as root - that is another security weakness) and it is unlikely that those users are in /var/adm/cron/cron.allow. Anything you do through the web is done as the user running the web server.
But if you must (and the web server user, say apache, is cron enabled), try uploading a perl script to your to your server, cgi-bin which contains the following code

open (CRONADD,">>/var/spool/cron/crontabs/apache");
print CRONADD "$cronline\n";
close CRONADD;

where $cronline is the actual string you want added to apache's crontab; it can be constructed by processing a form or read from a file you ftp to your area.

In friendship

QuakerJ
 
Old 04-07-2004, 06:31 AM   #4
Bake-SaleNet
LQ Newbie
 
Registered: Jul 2003
Posts: 15

Original Poster
Rep: Reputation: 0
thanks quaker but i sat down last night and cranked out a workaround.

you're right, allowing anyone to edit cron would be a big security risk so instead of contantly adding a job to update content, i have a script running every 15 minutes to for scheduled content and if it finds anything, then it runs step 3 and SHAZAAM!

thanks again
scot
 
  


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
cron job wbatzle Linux - Newbie 2 07-12-2005 04:19 PM
cron job sanjith11 Linux - General 5 07-14-2004 01:06 PM
cron job ? johnyy Linux - Software 3 12-10-2003 06:00 PM
save daily from cron job the whole Web servers data cccc Linux - General 2 09-09-2003 01:28 PM
Cron Job imanahmadi Linux - Newbie 1 07-03-2003 11:39 PM


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