Cron Job Setup VPS


New Member
Just a little guidance please relating to cron jobs on my new VPS.

I have a .php file that I want to be run via a cron job on the 15th day of each month. The php file, which I've used on cpanel shared accounts, downloads a file, decompresses the file, and saves the file.

This is what I've done so far:
- created a new directory / folder in the /home/ directory using filezilla;
- uploaded the .php file to that directory;
- used Putty / SSH access, to edit the crontab and include the cron instructions using crontab -e.

Please confirm that this is correct for the cron instructions
0 0 15 * * /usr/local/bin/php /home/newdir/myphpfile.php

I just want to check that the "/usr/local/bin/php" part of the first section of the instructions is the correct path that will run the myphpfile.php as a php file.

After I setup the cron in the crontab, I used this command to check if the cron is working. But I guess I will not see any log record until the cron runs the first time.
grep "update-geolite.php" /var/log/cron

Is there another method to test the cron to ensure it is working OK?

Hi rediim,

Did you run the command manually in SSH? If it runs manually it should run via cron as well.

I have a few php files that cron runs also and they use /usr/local/cpanel/3rdparty/bin/php-cgi, you might try that as well.

Hope that helps!
That's easy.

1) modify your php script to output anything - let it print 'done' for example
2) crontab -e; and then
a) change your job temporarily to run in 5 minutes from now
b) if you have MAILTO="" then comment it out

in 5 minutes, if everything is all right, you'll have a log entry about your script, and the user
the crontab belongs to should receive an email with whatever printed out in #1

if everything is all right, just roll back your changes.