I have this on my crontab
10 6 * * * java -jar /.../myproject.jar >> /../myjob.log 2>&1
I want run my app only the week (Monday to Friday)
This line is ok ? :
10 6 * * 1-5 java -jar /.../myproject.jar >> /../myjob.log 2>&1
That is a correct way to run the job on days 1 through 5 (Sunday being 0 (or 7)). Alternatively, you could explicitly list the days:
10 6 * * 1,2,3,4,5 java -jar /.../myproject.jar >> /../myjob.log 2>&1
You'll want to be careful about adding a "day of month" (field 3) restriction, apart from *
; if both values are specified, then cron will run the job when either field matches.
Yes, that looks right.
10 6 * * 1-5 java -jar /.../myproject.jar >> /../myjob.log 2>&1
This would run the command at 06:10 (6.10am) every week day (Monday to Friday).