-1

I'm using whm/cpanel and the first time i'm doing a cron job.

I have a php file located in /home/my_website/public_html/wp-content/youtube_channels/cron.php

I want this to run every minute.

I have this as a cron command but i want to make sure it is correct before going forward.

***** /home/my_website/public_html/wp-content/youtube_channels/cron.php

Is this correct? I want this code to run every minute.

user892134
  • 3,078
  • 16
  • 62
  • 128

2 Answers2

1

A crontab line

* * * * * php /path/to/phpfile.php >> /path/to/logfile.log 2>&1

  • * * * * * time settings
  • php to execute an php file, You can not just call the phpfile like an executeable file (only if you setup and add #!/usr/bin/php correctly)
  • >> pipes the output from the phpfile into logfile (or else)
  • /path/to/logfile.log the log file
  • 2>&1 ensures that all what is comeing from STDOUT and STDERR is piped into the logfile.

More info:

https://corenominal.org/2016/05/12/howto-setup-a-crontab-file/

Run a PHP file in a cron job using CPanel (not only for CPanel user)

http://php.net/manual/en/wrappers.php.php (STDOUT/STDERR)

Have a nice cron

Community
  • 1
  • 1
JustOnUnderMillions
  • 3,741
  • 9
  • 12
0

For a crontab entry, you need spaces between the stars -

* * * * * /home/my_website/public_html/wp-content/youtube_channels/cron.php
anshulk
  • 458
  • 5
  • 13