Cron job in centos - cron

I have few more doubt in crontab jobs
My scenario: I have put two cron jobs at 23 Hrs every day 1 job is move files to another directory & the 2nd job is upload this file to ftp server.
How to get last ran time cron job & last run result( if succeeded or failed )details in centos ?
How to view at present running cron job in centos ? ( example : 1st job starting at 23 Hrs & the 2nd job starting at 23:30 Hrs and ending after 5 mins { assuming 1st cron job should be completed after 30mins , I want to view this job running details in live.(30 mints duration ) })
Log or live view
Note: Running as root user privilege.
Thanks
G Dhamu

You can watch the logs of jobs that were ran by cron under /var/log/cron (default location)
You cannot have a "live view" since you're not the one who's running it... What you can do, is tail cron-log or have your program write its output to a different log and open a screen that tails it.

How to upgrade apache 2.4.6 to 2.4.16 on CentOS -7..
‪#‎cat‬ /etc/redhat-release
CentOS Linux release 7.1.1503 (Core))

Related

Run a command every 5 minutes and stop it at the end of that time

I have to run NodeJS application which has to run uninterruptedly, but I need to stop it and restart it every 10 minutes.
I'm Working on a dedicated Ubuntu 18.04 machine.
I have read something about cron but I don't know well how it works. Does it stop the command that was run with it?
You can use forever to run the application, and set up a cron job to restart it in forever every five minutes. As a bonus, forever will also restart it for you if it fails in between cron job executions.
In my knowledge, the cron doesn't stop the command that had run before, but you could add the logic to do that check in your application.
Here you can find an article that shows some solutions to prevent duplicate cron job executions.

Cron daemon not running in debian

I am using Jessie. Cron was working fine last week. But I just checked today and found out, it's not working anymore. When I restart upstart loads my custom tasks. But if I check
sudo service --status-all
Cron is shown marked as [ - ] cron
When I execute sudo service --status-all, I get [FAIL] cron is not running ... failed! in return. Manually starting cron service executes the tasks in crontab. But, the service is not starting on boot.
There is no problem with crontab task specification. They are working fine on my other machines running Ubuntu.

Is there any time restriction for cloud9.ide?

I'm trying to run quick php update over cron tab on Cloud9 IDE.
Here is my crontab -l:
*/2 * * * * php /home/ubuntu/workspace/public_html/updater.php
I also tried to use data from "whereis php" instead of simple php, but still nothing.
And here comes my question. Is there any time restriction eg. 1 hour minimum for cron in C9?
Or maybe I'm doing something wrong.
Tried to restart cron already.
Cron daemon is not started. You have to start it manually. Your output from px -aef | grep cron shows that grep is running not cron.
sudo cron start
Please read here, from the C9 FAQ:
We currently do not support cron jobs within Cloud9 workspaces. The way to proceed would be to get a Cloud9 premium plan which allows you to create SSH workspaces
You may need to run the cron daemon to make the cron job run ("service cron start"). However Cloud9 workspaces are paused when they are inactive so it will only run when you're actively logged into the IDE.

Redhat openshift - Cron Runtime - Is there a default time for how long cron executes

Cron on Redhat openshift is cancelled by SIGTERM after some minutes.
Is there a default timeout on how long cron tasks can execute?
If yes, how to get long running tasks working?
Yes, There is apparently a default timeout of 5 min on top level script for cron tasks execution on Redhat openshift.
The solution is to use "nohup" to get long running tasks working.
For ex:
File .openshift/cron/minutely/task1 -
nohup /path-to/some-other-script > $OPENSHIFT_LOG_DIR/logfile 2>&1 &

Magento Cron Job Problem

In Magento I have set the cron job to run every minute and I also created a cron job in the plesk control panel because the magento setup wasn't working for me.
So I created a cron job as follows:
/usr/bin/php -f /home/dealscou/public_html/cron.php
This works for me most of the time when the cron job is set to 1 minute.
If I create a cron job for any other amount of time, it does not work.
I am really stuck on this and my customer is getting ticked that I can't fix it.
Any help would be appreciated.
Kathy
You should run the cron from the cron.sh file and not directly from the cron.php file

Resources