Celeb Glow
news | March 11, 2026

Cron runs only once instead every minute

I'm trying to run a script every minute (on a Docker container running Ubuntu 16.04).

The /etc/echo.sh simply echo the word "hi"

cat /etc/crontab
* * * * * root /etc/echo.sh > /var/log/cron.log 2>&1
/etc/init.d/cron reload * Reloading configuration files for periodic command scheduler cron [ OK ]
tail -f /var/log/cron.log
hi

After printing "hi" once, nothing happens anymore.

Any ideas why?

2

2 Answers

The script does run every minute but > truncates the file each time.

If the file does not exist, it shall be created; otherwise, it shall be truncated to be an empty file after being opened.

(source)

Use >> instead to append to the file.

6
*/1 * * * * root /etc/echo.sh > /var/log/cron.log 2>&1

I think that this is the problem. You must change the crontab minute option to */1 to run that bash every minute.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy