What would be wrong with making a CGI-page with a "Send Now!" button which directly starts sending the mail? Is there any good reason why you have to go the PHP->Perl->crontab->sendmail way?
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] [d/l] [select] |
Cron's purpose is to run tasks periodically.
You need at for running a job one time.
| [reply] |
As Ultra pointed out, cron is really the wrong tool for this sort of task -- put all thoughts of cron out of your mind. And as CountZero pointed out, you don't seem to have any reason to make this so complicated.
If you have message content in a text file, and a list of email addresses in another file, simply launch some kind of script (perl or shell) that will mail the text to the address list. (Or maybe there's some function or facility in PHP that handles this?)
If you think it really can't be as simple as that, we can't give you any better answer yet, because you haven't told us what the complicating factors are. | [reply] |
system ( "crontab -l > oldcrontab ; cp oldcrontab newcrontab ; echo '
+*/2 * * * * mystupidPERLscript.pl' >> newcrontab ; crontab newcrontab
+" );
| [reply] [d/l] |
The problem with using a button on a web page is that the script will only continue sending as long as the browser is sitting there waiting for response. If you quit the browser in the middle, the process stops. I usually get around this by running my mailings while I sleep, but if you need your mailings done on a precise schedule, you need something like what Ultra suggested. | [reply] |
The problem with using a button on a web page is that the script will only continue sending as long as the browser is sitting there waiting for response. Is that true? I really doubt that. Once you fire off a CGI-script, it will run its course, whether or not there is still a browser "listening". I don't think the webserver will kill off a script as soon as the browser closes. And in case the script starts an external program (as in the OP), that is certainly not getting killed off by the webserver.
CountZero "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law
| [reply] |