Suddenly the hourly cron job on openshift stopped working.
I am using a free account and the cron was running fine until suddenly it just stopped working.
Minutely jobs on the other hand are running fine, given the following files
app-root/runtime/repo/.openshift/cron/minutely/cminut
#!/bin/bash
echo 'ping'
and
app-root/runtime/repo/.openshift/cron/hourly/chour
#!/bin/bash
echo 'pong'
as well as the following permissions
[xxx-xxxxxxx.rhcloud.com cron]\> ls -la hourly/
total 4
drwx------. 2 1234567 1234567 18 Jun 28 19:04 .
drwx------. 4 1234567 1234567 52 Jun 28 19:04 ..
-rwx--x--x. 1 1234567 1234567 24 Jun 28 19:04 chour
[xxx-xxxxxxx.rhcloud.com cron]\> ls -la minutely/
total 4
drwx------. 2 1234567 1234567 19 Jun 28 19:04 .
drwx------. 4 1234567 1234567 52 Jun 28 19:04 ..
-rwx------. 1 1234567 1234567 24 Jun 28 19:04 cminut
[xxx-xxxxxxx.rhcloud.com cron]\>
The minutely cron job runs fine and i can see the log file cron_minutely.log in $OPENSHIFT_LOG_DIR
For the hourly cron job i can not see the cron_hourly.log neither the job is executed
My previous attempts wen't trough uninstalling and re installing the cron cartridge as mentioned here but there was no success running the hourly cron job.
Is there any other way that i can debug this, or any openshift specific fix known in order to solve this?
After some desperate attempts and inspecting the cron job cartridge script cron_runjobs.sh
i came to note that whenever i runed the hourly cron via this script the log
":SKIPPED: $freq cron run for openshift user '$OPENSHIFT_GEAR_UUID"
popped up, such message was not fired for other crons (minutely, weekly...)
upon closer inspection i noticed that there were several processes with this script cron_runjobs.sh running on the server, after killing this processes and re-deploying the application the hourly cron job started again to work as expected.
I do not know why were these processes hanged and still running, maybe because i used sleep in the hourly cron before, although not sure if that was the reason.
Related
$ pm2 --version
1.1.1
Started a shell script with pm2. It was gonna run for about 12 hours. Went back to check on it the next day and it was only halfway done. But I checked the logs and it looked like it had started over. Checked pm2 ls and yes, it had, 3 times. That seemed strange since all it was doing was sending some curls and had been doing fine for hours.
So I went to look at the error output:
[collumj#serverName ~]$ ll /opt/xyz/.pm2/logs | grep util-perf-testing
-rw-r--r-- 1 collumj alskdjflkas 0 Oct 12 21:27 util-perf-testing-error-54.log
-rw-r--r-- 1 collumj alskdjflkas 0 Oct 12 21:38 util-perf-testing-error-59.log
-rw-r--r-- 1 collumj alskdjflkas 6.8K Oct 12 21:36 util-perf-testing-out-54.log
-rw-r--r-- 1 collumj alskdjflkas 15K Oct 13 00:00 util-perf-testing-out-59__2016-10-13_00-00-00.log
-rw-r--r-- 1 collumj alskdjflkas 166K Oct 14 00:00 util-perf-testing-out-59__2016-10-14_00-00-00.log
-rw-r--r-- 1 collumj alskdjflkas 384K Oct 14 17:16 util-perf-testing-out-59.log
The two error logs are completely empty.
Does PM2 keep any sort of internal logs about restarts? The output of the shell script doesn't show any reason for it to restart and the error logs are empty. I'm looking at a complete mystery as to why this shell script would have restarted 3 times.
PM2 will store the reasons for resets in its log, which can be accessed like so: tail --lines 100 ~/.pm2/pm2.log.
I am trying atq to see what job is scheduled to run.
$ atq
19 Tue Mar 1 08:00:00 2016
But the number 19 is not very helpful. Is there a way to see what commands will be run by job 19? Thanks.
Yes, you can use:
at -c <jobid>
at -c 19
Perhaps I'm just missing something simple so here goes.
I have a webmin server on Ubuntu and also OpenGTS on a vps, everything works fine and I set it all up from scratch.
I have a cron job like this:
bash /usr/local/OpenGTS_2.5.0/bin/trim.sh
trim.sh is:
#!/bin/sh
MAILTO=me#mymail.net
cd /usr/local/OpenGTS_2.5.0/bin/
./admin.sh Device -account=vehicles -device=laguna -deleteOldEvents=-5d -confirmDelete
This should delete old entries from the database older than 5 days
When run from command line it outputs correctly
Entry Point: org.opengts.db.tables.Device
Deleting events before "Wed Jun 11 23:59:59 BST 2014" ...
Device: laguna - Deleted 0 old events (Saved last event, Nothing to delete)
However when it runs from cron
Entry Point: org.opengts.db.tables.Device
Deleting events before "Mon Jun 09 23:59:59 BST 2014" ...
Device: laguna - Deleted 0 old events (Empty range)
If I set it to 1 day, or 2 days it still insists on Mon Jun 09 23:59:59 BST 2014
I'm totally stumped, any ideas ?
thanks
I am a beginner at linux and really enthusiastic to learn the OS. I am trying to launch Firefox(or any other software like Evince) from the command line as follows:
[root#localhost ~]# at 1637
[root#localhost ~]# at> firefox
[root#localhost ~]# at> ^d
The job gets scheduled without any error. But at the specified time it does not run.
I also tried giving the following path:
[root#localhost ~]# at 1637
[root#localhost ~]# at> /usr/bin/firefox
[root#localhost ~]# at> ^d
Still no result. But When I try to use echo to display a text on the screen it appears at the specified time as desired. What might be the issue?
I think you have not set DISPLAY. at will run in separate shell where display is not set.
try the following code.
dinesh:~$ at 2120
warning: commands will be executed using /bin/sh
at> export DISPLAY=:0
at> /usr/bin/firefox > firefox.log 2>&1
at> <EOT>
job 7 at Tue Mar 11 21:20:00 2014
If it is still failing check firefox.log for more information.
1) Its not always recommended to run things as root
2) You can also try ./firefox if you are in the current directory of firefox. In linux you need to pay attention to your path variable. Unless . (the current directory) is in your path you will have to type ./program if the program is in the same directory as you.
Also you need to pay attention to file permissions: In linux you have read-write-eXecute access.
ls -l will do a list of directories and show the file permissions:
drwxr-xr-x 10 user staff 340 Oct 6 2012 GlassFish_Server/
drwx------# 15 jeffstein staff 510 Oct 6 15:01 Google Drive/
drwxr-xr-x 20 jeffstein staff 680 May 14 2013 Kindle/
drwx------+ 67 jeffstein staff 2278 Jan 26 14:22 Library/
drwx------+ 19 jeffstein staff 646 Oct 23 18:28 Movies/
drwx------+ 15 jeffstein staff 510 Jan 3 20:29 Music/
drwx------+ 90 jeffstein staff 3060 Mar 9 20:23 Pictures/
drwxr-xr-x+ 6 jeffstein staff 204 Nov 3 21:16 Public/
drwxr-xr-x 22 jeffstein staff 748 Jan 14 2012 androidTools/
-rwxrwxrwx 1 jeffstein staff 1419 Aug 28 2013 color.sh*
This is an example of ls -l here you can see color.sh has -rwxrwxrwx that means that anybody can read or write or run the file.
Without actually knowing where you installed firefox however I can't be of more help but these are some small pointers which might help.
try finding where firefox is actually installed using "whereis firefox" command.
Then try using that path in at command.
In order to get directions on how to use a command type:
man at
this will display the "manual"
DESCRIPTION
The at and batch utilities read commands from standard input or a speci-
fied file. The commands are executed at a later time, using sh(1).
at executes commands at a specified time;
atq lists the user's pending jobs, unless the user is the superuser;
in that case, everybody's jobs are listed;
atrm deletes jobs;
batch executes commands when system load levels permit; in other words,
when the load average drops below _LOADAVG_MX (1.5), or the value
specified in the invocation of at run.
So obviously you need to schedule a job with at and you can see if it worked with atq
Read the manual and it should help - if i have more time I'll write you a quick example.
I was just looking at our server root and one of our old developers who has left seems to have a cron job running daily which is writing a file every day to the server root.
I had a look at the daily cron jobs and I guess this is the culprit as it's the only wget (the others are PHP scripts which I know run silently):
wget http://www.example.com/?option=com_portal&view=ops&tmpl=component >/dev/null 2>&1
Each day the server root has a file like this written:
-rw-r--r-- 1 root root 11987 May 12 03:45 login.360
-rw-r--r-- 1 root root 11987 May 13 03:45 login.361
-rw-r--r-- 1 root root 11987 May 14 03:45 login.362
-rw-r--r-- 1 root root 11987 May 15 03:45 login.363
A new one for every day. The content of the file is the HTML page source. How can I safely modify the cron job to stop any output like this, until I do some further investigations into removing this cron job altogether?
My question basically is how can I still request the page but prevent it from outputting it to the server root?
How about making wget dump the data to /dev/null?
wget -O/dev/null http://www.example.com/blab