Welcome to the Cumulus Support forum.
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024
Cumulus MX V4 beta test release 4.0.0 (build 4019) - 03 April 2024
Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)
Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki
Running a cron job for advisories
Moderator: saratogaWX
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Running a cron job for advisories
First of all, let me say I have never, and I mean never, had anything to do with a cron job. However, I'd like to add more areas to my advisories, When looking at the comments in the settings.php it says "if more than 4 zone/county codes are used, a message will appear if you are NOT using cron to provide updates". So how do I do set up a cron job to allow me to have more than 4 advisory code/zones?
- saratogaWX
- Posts: 1198
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Running a cron job for advisories
Setup of a cron job is very hoster-specific. Some have a website 'control panel' where you enter the cron specifications.
Some hosters only offer cron functions through the command-line interface (when logged in via SSH).
First check your hoster's Q&A about cron jobs to see which variety they support.
Then we can try to help with getting it set up...
Just FYI, my 1and1 hoster uses the command-line interface (via SSH login thru PuTTY). In my crontab, I have the
entry:
*/5 * * * * /kunden/homepages/9/d141952417/htdocs/wx/run-nws-alerts.txt
Which says:
Every 5 minutes (the */5) run the command run-nws-alerts.txt
The run-nws-alerts.txt is really a bash script to run the nws-alerts collection and save the results.:
Note that ALL the paths for files are VERY HOSTER SPECIFIC so you can't just copy/paste without editing
to reflect your hoster's environment. Also, some hosters do not offer cron job functionality. In that case,
you can use a Windows Task Manager scheduled task to read http://your.website.com/nws-alerts.php every 5 minutes and that will do the same as the (missing) cron job functionality.
Hope this helps...
Best regards,
Ken
Some hosters only offer cron functions through the command-line interface (when logged in via SSH).
First check your hoster's Q&A about cron jobs to see which variety they support.
Then we can try to help with getting it set up...
Just FYI, my 1and1 hoster uses the command-line interface (via SSH login thru PuTTY). In my crontab, I have the
entry:
*/5 * * * * /kunden/homepages/9/d141952417/htdocs/wx/run-nws-alerts.txt
Which says:
Every 5 minutes (the */5) run the command run-nws-alerts.txt
The run-nws-alerts.txt is really a bash script to run the nws-alerts collection and save the results.:
Code: Select all
#!/bin/bash
cd /kunden/homepages/9/d141952417/htdocs/wx
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
/usr/bin/php5 -q nws-alerts.php > nws-alerts-status.tmp
cp nws-alerts-status.tmp nws-alerts-status.txt
#
to reflect your hoster's environment. Also, some hosters do not offer cron job functionality. In that case,
you can use a Windows Task Manager scheduled task to read http://your.website.com/nws-alerts.php every 5 minutes and that will do the same as the (missing) cron job functionality.
Hope this helps...
Best regards,
Ken
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
Let's see if I understand this. As I do not have any run-nws-alerts.txt file, I should run nws-alerts.php? The cron I have created is:saratogaWX wrote:Setup of a cron job is very hoster-specific. Some have a website 'control panel' where you enter the cron specifications.
Some hosters only offer cron functions through the command-line interface (when logged in via SSH).
First check your hoster's Q&A about cron jobs to see which variety they support.
Then we can try to help with getting it set up...
Just FYI, my 1and1 hoster uses the command-line interface (via SSH login thru PuTTY). In my crontab, I have the
entry:
*/5 * * * * /kunden/homepages/9/d141952417/htdocs/wx/run-nws-alerts.txt
Which says:
Every 5 minutes (the */5) run the command run-nws-alerts.txt
The run-nws-alerts.txt is really a bash script to run the nws-alerts collection and save the results.:
Note that ALL the paths for files are VERY HOSTER SPECIFIC so you can't just copy/paste without editingCode: Select all
#!/bin/bash cd /kunden/homepages/9/d141952417/htdocs/wx # Clean out old copies if any ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1 /usr/bin/php5 -q nws-alerts.php > nws-alerts-status.tmp cp nws-alerts-status.tmp nws-alerts-status.txt #
to reflect your hoster's environment. Also, some hosters do not offer cron job functionality. In that case,
you can use a Windows Task Manager scheduled task to read http://your.website.com/nws-alerts.php every 5 minutes and that will do the same as the (missing) cron job functionality.
Hope this helps...
Best regards,
Ken
*/5* * * * /usr/local/bin/php /home/elghek00/domains/domain.com/public_html/nws-alerts.php
I hope that is correct. As there have no alerts lately, it may be some time before I fine out?
- saratogaWX
- Posts: 1198
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Running a cron job for advisories
Almost right...
change to
there needs to be a space after the */5
A better approach might be to create run-nws-alerts.txt in your document root (same place as nws-alerts.php) with the contents
then change the cron entry to read
That makes sure that the nws-alerts.php uses your home directory default.
Best regards,
Ken
change
Code: Select all
*/5* * * * /usr/local/bin/php /home/elghek00/domains/domain.com/public_html/nws-alerts.php
Code: Select all
*/5 * * * * /usr/local/bin/php /home/elghek00/domains/domain.com/public_html/nws-alerts.php
A better approach might be to create run-nws-alerts.txt in your document root (same place as nws-alerts.php) with the contents
Code: Select all
#!/bin/bash
cd /home/elghek00/domains/domain.com/public_html
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
/usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp &2>1
cp nws-alerts-status.tmp nws-alerts-status.txt
#
Code: Select all
*/5 * * * * /bin/bash /home/elghek00/domains/domain.com/public_html/run-nws-alerts.txt
Best regards,
Ken
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
Ken,saratogaWX wrote:Almost right...
changetoCode: Select all
*/5* * * * /usr/local/bin/php /home/elghek00/domains/domain.com/public_html/nws-alerts.php
there needs to be a space after the */5Code: Select all
*/5 * * * * /usr/local/bin/php /home/elghek00/domains/domain.com/public_html/nws-alerts.php
A better approach might be to create run-nws-alerts.txt in your document root (same place as nws-alerts.php) with the contentsthen change the cron entry to readCode: Select all
#!/bin/bash cd /home/elghek00/domains/domain.com/public_html # Clean out old copies if any ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1 /usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp &2>1 cp nws-alerts-status.tmp nws-alerts-status.txt #
That makes sure that the nws-alerts.php uses your home directory default.Code: Select all
*/5 * * * * /bin/bash /home/elghek00/domains/domain.com/public_html/run-nws-alerts.txt
Best regards,
Ken
I did just as you suggested and it appears to working just fine. Now to await for some alerts to show up.
Tom
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
Ken,
Looks like I spoke way to soon. I am getting the following in my source with the portion in blue showing up at the top of my page:
<!-- nws-alerts noCron=true .. running nws-alerts.php inline -->
nws-alerts: Checking more than four warning/county codes can delay the loading of your pages. You should use a cron job to get the data.
<!-- nws-alerts.php - 1.15 - 19-Aug-2013 - NWS Public Alerts -->
<!-- Cron job not used -->
My cron code looks like:
*/5 * * * * /home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt >/dev/null 2>&1
and my run-nws-alerts.txt looks like the following:
#!/bin/bash
cd /home/elghek00/domains/domain.com/public_html
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
/usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp &2>1
cp nws-alerts-status.tmp nws-alerts-status.txt
#
So why doesn't this work? I have set the permissions to 777 in an attempt tp see if that will help. Nope, it didn't. Now what? Wish I understood Cron a lot better.
Looks like I spoke way to soon. I am getting the following in my source with the portion in blue showing up at the top of my page:
<!-- nws-alerts noCron=true .. running nws-alerts.php inline -->
nws-alerts: Checking more than four warning/county codes can delay the loading of your pages. You should use a cron job to get the data.
<!-- nws-alerts.php - 1.15 - 19-Aug-2013 - NWS Public Alerts -->
<!-- Cron job not used -->
My cron code looks like:
*/5 * * * * /home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt >/dev/null 2>&1
and my run-nws-alerts.txt looks like the following:
#!/bin/bash
cd /home/elghek00/domains/domain.com/public_html
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
/usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp &2>1
cp nws-alerts-status.tmp nws-alerts-status.txt
#
So why doesn't this work? I have set the permissions to 777 in an attempt tp see if that will help. Nope, it didn't. Now what? Wish I understood Cron a lot better.
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
Still trying to get this problem resolved. My Cronjob is as follows (as suggested earlier):
*/5 * * * * /home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt
My run-nws-alerts.txt is as follows (also as suggested earlier):
#!/bin/bash
cd /home/elghek00/domains/elgheko.us/public_html/
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
/usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp &2>1
cp nws-alerts-status.tmp nws-alerts-status.txt
#
I am seeing the following in my index.php file:
<!-- nws-alerts noCron=true .. running nws-alerts.php inline -->
nws-alerts: Checking more than four warning/county codes can delay the loading of your pages. You should use a cron job to get the data.
<!-- nws-alerts.php - 1.15 - 19-Aug-2013 - NWS Public Alerts -->
<!-- Cron job not used -->
However, I am not getting any error messages in my email. Why can't I get this cron job to work? I am confused. I really want to get this resolved.
Tom
*/5 * * * * /home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt
My run-nws-alerts.txt is as follows (also as suggested earlier):
#!/bin/bash
cd /home/elghek00/domains/elgheko.us/public_html/
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
/usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp &2>1
cp nws-alerts-status.tmp nws-alerts-status.txt
#
I am seeing the following in my index.php file:
<!-- nws-alerts noCron=true .. running nws-alerts.php inline -->
nws-alerts: Checking more than four warning/county codes can delay the loading of your pages. You should use a cron job to get the data.
<!-- nws-alerts.php - 1.15 - 19-Aug-2013 - NWS Public Alerts -->
<!-- Cron job not used -->
However, I am not getting any error messages in my email. Why can't I get this cron job to work? I am confused. I really want to get this resolved.
Tom
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
A folowup here. Finally I got an email from the cron job. It says:aznetcowboy wrote:Still trying to get this problem resolved. My Cronjob is as follows (as suggested earlier):
*/5 * * * * /home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt
My run-nws-alerts.txt is as follows (also as suggested earlier):
#!/bin/bash
cd /home/elghek00/domains/elgheko.us/public_html/
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
/usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp &2>1
cp nws-alerts-status.tmp nws-alerts-status.txt
#
I am seeing the following in my index.php file:
<!-- nws-alerts noCron=true .. running nws-alerts.php inline -->
nws-alerts: Checking more than four warning/county codes can delay the loading of your pages. You should use a cron job to get the data.
<!-- nws-alerts.php - 1.15 - 19-Aug-2013 - NWS Public Alerts -->
<!-- Cron job not used -->
However, I am not getting any error messages in my email. Why can't I get this cron job to work? I am confused. I really want to get this resolved.
Tom
/home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt: line 6: 790 Terminated /usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp
I have no idea what this is telling me. Just as I was hopeful that the cron job was working.
I am getting messages via email addressed to "Cron <elghek00@lhvm02> /home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt" stating "kill 756: No such process". The number after the Kill word varies from three to five digits. What is this telling anyone?
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
Just wondering here if my run-nws-alerts.txt is set up correctly? I noticed that the "nws-alerts: Checking more than four warning/county codes can delay the loading of your pages. You should use a cron job to get the data." message is coming from the nws-alerts-status.tmp file and the nws-alerts-status.txt is empty.aznetcowboy wrote:aznetcowboy wrote:Still trying to get this problem resolved. My Cronjob is as follows (as suggested earlier):
*/5 * * * * /home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt
My run-nws-alerts.txt is as follows (also as suggested earlier):
#!/bin/bash
cd /home/elghek00/domains/elgheko.us/public_html/
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
/usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp &2>1
cp nws-alerts-status.tmp nws-alerts-status.txt
#
I am seeing the following in my index.php file:
<!-- nws-alerts noCron=true .. running nws-alerts.php inline -->
nws-alerts: Checking more than four warning/county codes can delay the loading of your pages. You should use a cron job to get the data.
<!-- nws-alerts.php - 1.15 - 19-Aug-2013 - NWS Public Alerts -->
<!-- Cron job not used -->
However, I am not getting any error messages in my email. Why can't I get this cron job to work? I am confused. I really want to get this resolved.
Tom
Is no one using a cron job for the advisories? Certainly I can't be the only one. What is wrong with my cron job??? I certainly am not seeing the problem.
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
The closer I seem to get, the more I wonder if anyone else is actually running a cron job for advisories. Right now as soon as I thought all was well, I get the following:
PHP Notice: Undefined index: SERVER_NAME in /home/elghek00/domains/elgheko.us/public_html/nws-alerts.php on line 544
PHP Notice: Undefined index: SERVER_NAME in /home/elghek00/domains/elgheko.us/public_html/nws-alerts.php on line 556
PHP Notice: Undefined index: SERVER_NAME in /home/elghek00/domains/elgheko.us/public_html/nws-alerts.php on line 556
PHP Notice: Undefined index: SERVER_NAME in /home/elghek00/domains/elgheko.us/public_html/nws-alerts.php on line 556
The last line referencing line 556 repeats 8 more times. I only find the reference to SERVER_NAME in the list 544 and 556. I am ready to give up on this cron job. I an starting to think it can't be done. I am open to any and all suggestions as how to get this resolved.
PHP Notice: Undefined index: SERVER_NAME in /home/elghek00/domains/elgheko.us/public_html/nws-alerts.php on line 544
PHP Notice: Undefined index: SERVER_NAME in /home/elghek00/domains/elgheko.us/public_html/nws-alerts.php on line 556
PHP Notice: Undefined index: SERVER_NAME in /home/elghek00/domains/elgheko.us/public_html/nws-alerts.php on line 556
PHP Notice: Undefined index: SERVER_NAME in /home/elghek00/domains/elgheko.us/public_html/nws-alerts.php on line 556
The last line referencing line 556 repeats 8 more times. I only find the reference to SERVER_NAME in the list 544 and 556. I am ready to give up on this cron job. I an starting to think it can't be done. I am open to any and all suggestions as how to get this resolved.
- saratogaWX
- Posts: 1198
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Running a cron job for advisories
It appears that your PHP/hoster does not set $_SERVER['SERVER_NAME'] environmental variable.
You can get around this by changing nws-alerts-config.php to
and that should clear the errors.
You can get around this by changing nws-alerts-config.php
Code: Select all
### END OF MAIN SETTINGS ###
Code: Select all
if(!isset($_SERVER['SERVER_NAME'])) {$_SERVER['SERVER_NAME'] = 'www.elgheko.us';}
### END OF MAIN SETTINGS ###
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
I added the code as suggested. I am now getting emails saying "kill 5580: No such process" where the kill number is anwhere from a three digit to a five digit number. In the index.php source code (right after the <body> statement) I am gettingsaratogaWX wrote:It appears that your PHP/hoster does not set $_SERVER['SERVER_NAME'] environmental variable.
You can get around this by changing nws-alerts-config.phptoCode: Select all
### END OF MAIN SETTINGS ###
and that should clear the errors.Code: Select all
if(!isset($_SERVER['SERVER_NAME'])) {$_SERVER['SERVER_NAME'] = 'www.elgheko.us';} ### END OF MAIN SETTINGS ###
Any suggestion as to what this kill statement is telling me? Boy, I never expected a cron job to be so complicated.<!-- nws-alerts noCron=true .. running nws-alerts.php inline -->
nws-alerts: Checking more than four warning/county codes can delay the loading of your pages. You should use a cron job to get the data.
<!-- nws-alerts.php - 1.15 - 19-Aug-2013 - NWS Public Alerts -->
<!-- Cron job not used -->
<!-- Total script process time: 0.0002 seconds -->
- saratogaWX
- Posts: 1198
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Running a cron job for advisories
The page says " noCron=true" and if you're running the cron, that should say " noCron=false".
Change nws-alerts-config.php line to to get the script to STOP trying to load when your page loads. Kinda contra-intuitive, but NOcron=false is equal (in logic) to cron=true
Getting the error message about 'kill' just means that there was no prior process running to kill. I do the kill to make sure that a 'hung' instance of the script won't stack up the PHP processes on the server and have your site return 500-Server Error when the number of PHP threads for your userid is exhausted.
In the cron job task itself, you can change to to turn off that attempt to kill prior running processes.
Some Linux installations do not like the '--no-run-if-empty' argument on the xargs command also.
Change nws-alerts-config.php line
Code: Select all
$noCron = true; // true=not using cron, update data when cache file expires false=use cron to update data
Code: Select all
$noCron = false; // true=not using cron, update data when cache file expires false=use cron to update data
Getting the error message about 'kill' just means that there was no prior process running to kill. I do the kill to make sure that a 'hung' instance of the script won't stack up the PHP processes on the server and have your site return 500-Server Error when the number of PHP threads for your userid is exhausted.
In the cron job task itself, you can change
Code: Select all
# Clean out old copies if any
ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
Code: Select all
# Clean out old copies if any
#ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
Some Linux installations do not like the '--no-run-if-empty' argument on the xargs command also.
- aznetcowboy
- Posts: 361
- Joined: Fri 04 Jan 2013 6:03 pm
- Weather Station: Davis 6153 Vantage Pro2
- Operating System: Windows 10 Home 64-bit
- Location: West Bend, WI USA
- Contact:
Re: Running a cron job for advisories
I had already done the "$noCron=false;" so that should be okay. I have just changed the line in the run-nws-alerts.txt as suggested.saratogaWX wrote:The page says " noCron=true" and if you're running the cron, that should say " noCron=false".
Change nws-alerts-config.php linetoCode: Select all
$noCron = true; // true=not using cron, update data when cache file expires false=use cron to update data
to get the script to STOP trying to load when your page loads. Kinda contra-intuitive, but NOcron=false is equal (in logic) to cron=trueCode: Select all
$noCron = false; // true=not using cron, update data when cache file expires false=use cron to update data
Getting the error message about 'kill' just means that there was no prior process running to kill. I do the kill to make sure that a 'hung' instance of the script won't stack up the PHP processes on the server and have your site return 500-Server Error when the number of PHP threads for your userid is exhausted.
In the cron job task itself, you can changetoCode: Select all
# Clean out old copies if any ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
to turn off that attempt to kill prior running processes.Code: Select all
# Clean out old copies if any #ps auxw | grep "nws-alerts.php" | grep -v 'grep' | awk '{print $2}' | xargs --no-run-if-empty kill >/dev/null &2>1
Some Linux installations do not like the '--no-run-if-empty' argument on the xargs command also.
BTW, I assume the emails I am getting that stating "/home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt: line 6: 28651 Terminated /usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp" are good meaning it has completed okay? Line 6 is "cp nws-alerts-status.tmp nws-alerts-status.txt".
- saratogaWX
- Posts: 1198
- Joined: Wed 06 May 2009 5:02 am
- Weather Station: Davis Vantage Pro Plus
- Operating System: Windows 10 Professional
- Location: Saratoga, CA, USA
- Contact:
Re: Running a cron job for advisories
Ummm... no, that's not a good thing. That the lineBTW, I assume the emails I am getting that stating "/home/elghek00/domains/elgheko.us/public_html/run-nws-alerts.txt: line 6: 28651 Terminated /usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp" are good meaning it has completed okay? Line 6 is "cp nws-alerts-status.tmp nws-alerts-status.txt".
/usr/local/bin/php -q nws-alerts.php > nws-alerts-status.tmp
was terminated probably means that /usr/local/bin/php wasn't found .. you may have to change it to the location of PHP on your hosting server (it varies on different hosters). It means your cron job is not quite running completely successfully.