-5

I've looked around online but can't find and simple explanations of how cronjobs function, and more specifically, where you command them to execute at a certain time.

I have found scripts like this:

0 1 * * * /usr/bin/php -q /home/your_username/public_html/script.php

But it doesn't explain where I put this. Do I save it in another PHP file, or somewhere else?

I have found a Cronjob section in my cPanel, but I'd rather code it myself.

Thanks

user3623348
  • 139
  • 3
  • 10
  • Look [here](https://en.wikipedia.org/wiki/Cron) – B001ᛦ Apr 12 '16 at 12:04
  • 2
    Possible duplicate of [How to create cron job using PHP?](http://stackoverflow.com/questions/18737407/how-to-create-cron-job-using-php) – Harikrishnan Apr 12 '16 at 12:05
  • 1
    Possible duplicate of [Using crontab to execute script every minute and another every 24 hours](http://stackoverflow.com/questions/5398014/using-crontab-to-execute-script-every-minute-and-another-every-24-hours) – Hugo Briand Apr 12 '16 at 13:46

1 Answers1

1

depending on your OS of your linux based server you would need to do this

first, ssh into your server.

$ sudo crontab -e

this will likely give you a menu of options like this:

Select an editor. To change later, run 'select-editor'.

  1. /bin/ed
  2. /bin/nano <---- easiest
  3. /usr/bin/vim.basic
  4. /usr/bin/vim.tiny

choose which ever you are familiar with.

then input the line as you have specified.

DevDonkey
  • 4,835
  • 2
  • 27
  • 41