Jump to content
Sign in to follow this  
wkg

Running Php As Cron Job

Recommended Posts

I found a php script I want to try out to backup mySQL databases (this one does all the databases and tables at once.)

 

Using cPanel to set up the job (standard method) seems pretty straight forward, but when it ran I got a "No such file or directory" error emailed to me.

 

I used /home/my-accountname/public_html/cgi-bin/backupDB/backupDB.php?StartBackup=complete&nohtml=1 as the command name. Where the script is located at /home/my-accountname/public_html/cgi-bin/backupDB/

 

All the directories are set to 755

 

Does it need to be in the bin directory, not the cgi-bin?

Share this post


Link to post
Share on other sites

That format would work if you were grabbing the URL via wget but not when accessing the file locally.

 

Try this

>php -q /home/my-accountname/public_html/cgi-bin/backupDB/backupDB.php StartBackup=complete nohtml=1

Share this post


Link to post
Share on other sites

Thanks, Dick, that gets me one more step along the way.

 

Is there somewhere I can find docs or syntax for how to set up the commands using cron? I gather the first parameter specifies a php script, but don't know what the -q does... and there might be other important things I should know lest I get myself into big trouble :) I tried searching for this, but didn't have any luck.

 

Thanks,

Bill

 

That format would work if you were grabbing the URL via wget but not when accessing the file locally.

 

Try this

>php -q /home/my-accountname/public_html/cgi-bin/backupDB/backupDB.php StartBackup=complete nohtml=1

Share this post


Link to post
Share on other sites

the 'q' is for 'quiet' i.e. it doesn't send lots of output to the 'screen' it just runs the php.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...