Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to create cron job to run shell script every minute

Tags:

bash

cron

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

like image 400
pythonic12 Avatar asked Sep 19 '25 08:09

pythonic12


1 Answers

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
like image 144
casonadams Avatar answered Sep 21 '25 00:09

casonadams