0

I just made a LAMP install and got SFTP working. My question now is: How do I set up cronjobs on Ubuntu server?

I need to make some cronjobs for my PHP/MySQL application. I look for un-activated users in my MySQL table, delete them, etc.

kiwo
  • 1
  • 1

1 Answers1

0

The easiest way that keeps all the code together is to create a web script (authenticated by some "secret", so random people can't call it for you) and call it from cron using:

wget -O - http://<yoursite>/cron.php?secret=<mybigsecret>

Then you need to add a cron entry (either using crontab -e), or just placing a file into:

/etc/cron.d/

with following contents:

0 3 * * * nobody wget -O - http://yoursite/cron.php?secret=<mybigsecret>

This will call the script every day at 03:00, for more information on crontab files syntax please consult crontab(5) man page (e.g. run "man 5 crontab").

oerdnj
  • 7,940