cron job
Moderator: General Moderators
Re: cron job
Create a crontab command for the entry.
Usually if you have a front-end control panel it makes it way easy.
Anyways you have to put in your time, which would be:
Then you need the entry in the format of /path/to/php /path/to/script.php, such as:
Usually if you have a front-end control panel it makes it way easy.
Anyways you have to put in your time, which would be:
Code: Select all
30 10 * * *
Code: Select all
/usr/bin/php /home/me/public_html/myscript.php
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Re: cron job
Is it possible to run the cron job on the command line to test ?
So far I've added the line:
30 10 * * * /script
Instead of having this line referencing to php:
/usr/bin/php /home/me/public_html/myscript.php
will adding this line at the top be the same:
#!/usr/local/bin/php -q
So far I've added the line:
30 10 * * * /script
Instead of having this line referencing to php:
/usr/bin/php /home/me/public_html/myscript.php
will adding this line at the top be the same:
#!/usr/local/bin/php -q
Re: cron job
I'm having a similar problem, but here is my environment and issue.
I'm using Putty for my connection to SSH. After logging in I use the command
crontab -e which opens the editor
I put the following commands in
# email for course start alert everyday at 8 am
00 08 * * * /usr/local/bin/php /var/www/vhosts/wtionline.cc/crontasks/emailcoursealert.php
My php file is listed under my hosting directory as stated in the path.
First, my question is how do I SAVE this file and where is it placed on the hosting server?
If I want to edit it again how do I do this. I'm assuming these are all command line functions, but not familiar with linux or putty.
I'm using Putty for my connection to SSH. After logging in I use the command
crontab -e which opens the editor
I put the following commands in
# email for course start alert everyday at 8 am
00 08 * * * /usr/local/bin/php /var/www/vhosts/wtionline.cc/crontasks/emailcoursealert.php
My php file is listed under my hosting directory as stated in the path.
First, my question is how do I SAVE this file and where is it placed on the hosting server?
If I want to edit it again how do I do this. I'm assuming these are all command line functions, but not familiar with linux or putty.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: cron job
Depends on the editor. If vim or vi you do SHIFT : then x to save and exit. For Gnu Nano it is CTRL o and then CTRL x I think. Where it saves it is dependent on the Linux distribution. Mine is /var/spool/cron/crontabsmarnieg wrote: First, my question is how do I SAVE this file and where is it placed on the hosting server?
Just do 'crontab -e' again.marnieg wrote:If I want to edit it again how do I do this. I'm assuming these are all command line functions, but not familiar with linux or putty.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: cron job
When I login it says "The program included with the Debian GNU/Linux system are free software. So I tried your Ctrl o and nothing happened. Also tried the SHIFT : but just got the characters :. The Ctrl just backed up the cursor one character to the left.
I will continue to google putty and see if I find other information.
Any other suggestions welcomed.
I will continue to google putty and see if I find other information.
Any other suggestions welcomed.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: cron job
It doesn't have anything to do with putty, it has to do with what the default editor on your system is.marnieg wrote:When I login it says "The program included with the Debian GNU/Linux system are free software. So I tried your Ctrl o and nothing happened. Also tried the SHIFT : but just got the characters :. The Ctrl just backed up the cursor one character to the left.
I will continue to google putty and see if I find other information.
Any other suggestions welcomed.
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.
Re: cron job
Yes I found figured out it was using the vi editor from my hosting company. I was able to create a file with my command and now just waiting to see if it works. I'm assuming the job is ready to run based on the Linux Server and it looks for cron jobs automatically.
Re: cron job
My job is not executing for some reason.
I contacted my hosting company to figure out the path for the file location and used pwd to get that information. Here is my final script
0 10 * * * /homepages/41/d283671596/crontasks/emailcoursealert.php
Is there a way for me to get a notice of whether the job had errors or executed at all. This should have ran at 10 AM Central time, which is the time of my server. The php script should be sending me an email message.
This is the only line in my script file.
I contacted my hosting company to figure out the path for the file location and used pwd to get that information. Here is my final script
0 10 * * * /homepages/41/d283671596/crontasks/emailcoursealert.php
Is there a way for me to get a notice of whether the job had errors or executed at all. This should have ran at 10 AM Central time, which is the time of my server. The php script should be sending me an email message.
This is the only line in my script file.
- AbraCadaver
- DevNet Master
- Posts: 2572
- Joined: Mon Feb 24, 2003 10:12 am
- Location: The Republic of Texas
- Contact:
Re: cron job
Well, if you are using the !#/usr/bin/php method then you need to set emailcoursealert.php to be an executable.
[text]CHMOD +x emailcoursealert.php[/text]
For the mail issue, add this to the top of the crontab:
[text]MAILTO=you@example.com[/text]
[text]CHMOD +x emailcoursealert.php[/text]
For the mail issue, add this to the top of the crontab:
[text]MAILTO=you@example.com[/text]
mysql_function(): WARNING: This extension is deprecated as of PHP 5.5.0, and will be removed in the future. Instead, the MySQLi or PDO_MySQLextension should be used. See also MySQL: choosing an API guide and related FAQ for more information.