How to add seconds for a cronjob [closed] - linux

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
This is the current running cronjob :
2 1 * * * cd /var/www; php auto.php
that says it will be run everyday # 1:02 AM ... How can i make it to run # 1:02:05 everyday?

It's not possible as the cron can only run in minutes interval at minimum.
What you can do to achieve the same effect is to have delay in your script as the fist line:
sleep(5); // sleep for 5 seconds
This way the script actually starts at 1:02:05.

Related

How to know if a task in the crontab actually was executed [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
I have a Script that is supposed to be execute by the crontab. How can I verify this at this moment if the task was programmed to be executed several hours ago?
You should modify your crontab file by adding a MAILTO=<your email here> before your cron so that you will be emailed the results of the execution. This won't solve your problem of knowing if the script executed in the past, but it may help you avoid this issue in the future. To make sure you get an email, just add an echo "Running script!" line to the top of your script.

Unix Auto NTP Time Synchronization on daily basis [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
My application is running on Linux server, Every three or four days, server time and EST time have different between 2 to 40 seconds. Is there any way to keep sync timing with NTP on daily basis.
The application is running 24X7, so can't reboot everyday to sync. Right now we are manage this problem by set time manually.
Thanks and appreciate.
Add a simple cron job to run ntp at whatever time you wish.
#Set time
0 0 * * * /usr/sbin/ntpdate ntp2.ja.net

How to add a cron job in linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I am using sphinx for searching. I get new data everyday which is added in the database.
I have to add this data into the sphinx search index so that it can be searched. For that I need to reindex the sphinx search index at regular intervals.
How can I set a cron in linux to do so?
a crontab is defined like this:
MIN HOUR DOM MON DOW CMD
so if you want to run a task on a daily basis try:
0 0 * * * /path/to/your/script
that will trigger the launch of your script everyday at 0:00
For more details, see the cron tag wiki

Scheduling cron Linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I would like to schedule a cron to take backup of my database every three days at mid-night.
So, is this correct?
0 0 */3 * * /usr/bin/mysqldump -hhost_ip -uusername my_db_name -ppassword > my_backup.sql
This question might have asked earlier, but I just want to confirm this.
Thanks. Any help would be of immense help!
no.
you miss user
# m h dom mon dow user command

Should linux cron jobs be specified with an "&" to indicate to run in background? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
In a crontab file, should commands be specified with a trailing "&", or will the command run in the background anyway?
I have:
*/20 * * * * /home/me/monitor/check.sh /home/me/monitor/check.properties >> /home/me/monitor/check.log 2>&1 &
I've seen contradictory answers to this question in various places. Some say no need to put an "&", others that without the ampersand cron waits for output from the command, even though all output is redirected.
Every job that's run by cron is run in the background automatically, so no need for the &
See this too.

Resources