Forum Moderators: bakedjake
Do they have to execute a unix script?
Do they have to only execute 1 script?
Is there any prewritten scripts posted on the web?(not really cron, more Unix in general).
Basically I want to mail a file as an attachment to an off server email address. This file is just a log file, used incase something goes wrong. I want to send it as an attachment to make it more user friendly to who will be using it. I have little to no experience is writting unix scripts.
Do they have to execute a unix script?
You can execute almost any script - provided the scripting engine is installed on the machine.
Do they have to only execute 1 script?
Nope.
Find a mail + attachment script for a language that is installed on your box - call it with a line in your crontab, PHP ex:
0,10,20,30,40,50 * * * * /opt/apache/bin/php /export/apache/info/htdocs/stockcron.php > /dev/null
Script runs approx every 10 minutes ¦ path to PHP scripting engine ¦ path to script which updates some stock info ¦ any output sent to nowhere...
I have done something VERY similar to what you want to achieve. I have a "stocklist" emailed to a set of users at a certain time in the morning. This list is generated, then sent by a script called via CRON.
I use PHP to send the script.
If you would like some advice, example scripts etc, please let me know :)
Cheers,
wruk999
Plus, I found something else that makes me want to use it, I can put security in it, and attach it to my admin page for my website, then the dummy users I have here can run the script from clicking a link. If they ever need this info emailed to them before the cron runs.
I'm sure you can do that with php calling a unix script, but this works good for me :)
What I did was create 1-liner Shell Scripts to run the Perl script.
I'd set up CRON to run this shell script, and the shell script would run my Perl. I bet this would work for your PHP scripts too.
The shell script looked like:
#!/bin/sh
/path/to/perlscript.pl
-----
I'm sure this was a terrible kludge, but it worked and was pretty easy. Just gotta keep track of two files now.