Jump to content
westman

Cron job -- linux

Recommended Posts

Hi all,
I am looking for the right command to give to run a php file using a cron job.
I have tried the following...
 
/usr/local/cpanel/bin/jailshell: -c: /home/my_username/public_html/folder/file.php"
/usr/local/cpanel/bin/jailshell -q /home/my_username/public_html/folder/file.php"
/usr/local/bin/php -q /home/my_username/public_html/folder/file.php"
/usr/bin/php -q /home/my_username/public_html/folder/file.php"
and
/home/my_username/public_html/folder/file.php"

I get this error in an email...

/usr/local/cpanel/bin/jailshell: -c: line 0: unexpected EOF while looking for
matching `"'
/usr/local/cpanel/bin/jailshell: -c: line 1: syntax error: unexpected end of file

What command should I give to run a php file from a cron job?

My linux server info:

cPanel Version 64.0 (build 12)
Apache Version 2.4.25
PHP Version 5.6.30

Share this post


Link to post
Share on other sites

Are you running the first cron job with the colons? 

/usr/local/cpanel/bin/jailshell: -c: /home/my_username/public_html/folder/file.php"

Try removing the colons and also the double quote at the ends of the cron jobs.

  • Like 1

Share this post


Link to post
Share on other sites

Last question for cron jobs.

I have this cron job working fine...
/usr/local/cpanel/bin/jailshell -q /home/my_username/public_html/folder/file.php
and if I go to www.mysite.com/folder/file.php the code will run.

how do I only give access to this file through cron job and not give access through www.mysite.com/folder/file.php

Share this post


Link to post
Share on other sites

You can place the file.php in a directory other than the public_html directory since everything in the public_html directory is accessible by the public.

For example, you can create a folder(directory) for cron job files in your home or username directory and call the file from there for the cron job:

/usr/local/cpanel/bin/jailshell -q /home/my_username/cron_jobs/file.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.

Loading...

×
×
  • Create New...