Honesty Rocks! truth rules.

Locking Cronjob

HOME      >>       Programming

khalilov

I've succesfully made my cronjob script but anyone can enter it by just typing its link. I want to lock it and make it unaccesible by anyone, except by the server every 30minutes. How do i do that? i've made the every 30 minutes part, i still need the no one can access it by simply typing its link thing.

On a side question, when i uploaded my cronjob script i forgot to remove all the echos that i used to test the script, iam just wondering when the script automatically runs is the echoed stuff stored somewhere? or just dismissed.

Also, i don't get the email thing in cronjob

Please enter an email address where the cron output will be sent:

I entered my email and no mails are being sent?
Edit: oh i get it, the echos are the ones i recieve in my email, nice.
Iam just wondering how do i make these messages go automatically to a certain folder in my inbox? (this is more like a MSN question i know =))

yordan

I see one funny way : put your script in a folder, and password-protect this folder. Use the cpanel option for that, and create a user and a password. Only this user will be able to run this script. The system will be able to run your cronjob task, but a guy who does not have the folder username and password will not.


pyost

All your "web files" are stored inside the public_html folder, and that's the only one that can be accessed by anyone. If you move your script(s) to another folder outside public_html (e.g. /home/khalilov/crons instead of /home/khalilov/public_html), only the server will be able to access them, and therefore execute them. That's how it's always done with server-only scripts.

 

As for filtering those e-mails, I can tell you how I do it in GMail - but I'm not sure MSN offers the same feature. In GMail you can set filters that deal with mail which contains a specified string in it's sender/subject field (or any other). Since I am hosted at Xisto - Web Hosting (ETA server insteat of GAMMA), I always get my cron mail from "Cron Daemon <root@eta.xisto.com>", and I use that as the criteria. You would just need to check on cron e-mail in order to find out what to use.