LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   adding new cron job via web (https://www.linuxquestions.org/questions/linux-software-2/adding-new-cron-job-via-web-166478/)

Bake-SaleNet 04-05-2004 12:22 PM

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...

Bake-SaleNet 04-06-2004 11:10 PM

nobody? no one at all? heh oh man. looks like im all alone on this one....

QuakerJ 04-07-2004 04:19 AM

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

Bake-SaleNet 04-07-2004 06:31 AM

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


All times are GMT -5. The time now is 04:21 AM.