Why does my cron job run every 1 minute although I set it every 1 hour?

Blaszard

I set my cron job via crontab -e, with the following code:

* */1 * * * python /var/www/your_script >/dev/null 2>&1

I didn't add .py extension as it makes the cron job invalid.

However, after logging it by grep CRON /var/log/syslog, the script is executed every one minute, not every one hour.

Mar  1 07:40:01 my-instance CRON[4471]: (me) CMD (python /var/www/your_script >/dev/null 2>&1)
Mar  1 07:41:01 my-instance CRON[4474]: (me) CMD (python /var/www/your_script >/dev/null 2>&1)
Mar  1 07:42:01 my-instance CRON[4477]: (me) CMD (python /var/www/your_script >/dev/null 2>&1)

Why does my script start to be run every one minute, not every one hour? My environment is Ubuntu 16.04.

d a i s y

If you want to set cronjob for every hour, you can do it any of following way:

You can run:

0 * * * * /path/to/script

which reads

On minute 0, each hour, each day of month, each month, each day of the week.

or

@hourly /path/to/script

or

0 */1 * * * /path/to/script

An asterisk (*) can be used so that every instance (every hour, every weekday, every month, etc.) of a time period is used.

Reference: crontab, CronHowto

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to run cron job every one hour and 10 min

How to set up a cron job to run an executable every hour?

How do I make cron run something every "N"th minute, where n % 5 == 1?

How to set a cron job to run every 3 hours

Run a Jenkins job every one minute using H/1 * * * *

How to set cron job to run every minute between 11 PM to 12AM Midnight

Windows Service run every hour in specific minute

How to run a cron jobs in every minute for a specific hour on server

Can a cron job be set to run every hour at 5 minutes after the hour?

Run a cron job every minute, meaning of syntax

Run cron job every 2 minutes except the first minute "0" of the first hour "0"

How to run a cron job to execute every minute?

Running a cron job randomly for every one hour

Running a cron job every 5 minute on arch

Why my cron job is running every minute when it is scheduled to run every hour?

Why Angular-cron-jobs generates the same cron expression for "Every Minute", "Every Hour at 0 past hour","Every Day at 0:0" etc

Run cron job every 2 hours In the X minute

How to run a CRON every 8h and 1 minute

How to set a cron job on Skygear to run every 12 hours?

How do I set a webjob to run every 1 hour in Azure

Cron Job firing every minute for an hour at it's scheduled execution time

cron expression to run a job every hour but only on weekdays?

jenkins cron: run every 3rd minute, starting at 1

How I can run mysql query automatically in every 1 hour?

python apscheduler not execute by cron for every 1 minute

How to set cron job run every hour and stop run 6 pm

I want to implement a spring cron scheduler that should run for the 1st time when the application is started and run every 1 hour from the next time

Timer every hour but starting from 1 minute

run cron every minute during a specific hour?