简体   繁体   中英

How to create cron job to run shell script every minute

I wan to create cron job that runs a shell script every minute I've tried editing contrab -e with:

1 * * * * sh ~/test.sh

to no avail

I recommend using: https://crontab.guru/

This is a really insightful way to create and understand cron jobs.

This should trigger every minute. However, when a cron runs it can run as a different user and that script location might be different. Adding a log file might help you track down what is going on.

* * * * * /bin/sh /home/user/test.sh >> /var/log/myjob.log 2>&1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM