Originally posted by philip pluckros
I have actually setup a little PHP script which stores the website hit count in a .txt file.
So, I guess all I need to do is view that file or as you say pipe it to a mailer.
How the hell do I do that?
Im, sorry, but I have never used the Unix operating system before.
How do I know if I have a mailer installed?
Type "mail" and hit enter. If you don't get an error saying "unknown command" then you do have mail installed (use "x" command to exit mailer).
If you're phased by this talk of pipes (one of the strengths of the command line IMO) and redirection, you'll probably be unsure of what I mean by 'stdout'. My understanding of PHP is that by default the output is to stdout i.e. output from 'print' appears in the shell window after the command is run.
If your PHP script writes a text file, could you not change it so it writes its output on stdout, then pipe the output to the mailer? You'll not have to clear up the .txt file after yourself.
One thing you have to watch out for is that cron runs its commands with a restricted PATH envvar, and you should use fully-qualified command names. You should ask the sysadmin if mail is installed, and what its full pathname is.
With these two changes, the cron entry will look something like this. Oh yeah ... have you entered something in a crontab before? "crontab -e" will bring up the editor referred to in the EDITOR envvar, or vi if you're unlucky ;-)