I wish I could say this, too.
Here are my files and logs. I think they speak for themself…
The only thing I changed was the name, until I felt comfortable with it and today the ExecStartPre
entry, to reduce it at least to nearly full hours. But (this is usually not enough, as you can see for my OnCalendar
entries…
Please note the execution times, especially for the .timers log. (e.g. 21:10:39 (right after ending suspend))
Or of the .service log: 07:44:00, while 5…9:00:00 no execution is scheduled at all for Mondays…
So: If you see any mistakes, which caused it to run it asynchronously, let me know.
myjob.service
[Unit]
Description=MyJob execution
#For MyJob scheduler
[Service]
Type=oneshot
ExecStartPre=bash -c 'if [ "$(date +%%M)" -lt 2 ] ; then true ; else false ; fi' # This is new since today
ExecStart=+/root/scripts/MyJob.sh
myjob.timer
[Unit]
Description=Schedule for MyJob
#WITHOUT asynchronously execution
[Timer]
#OnCalendar=Mon *-*-* 20..22:00:00
#OnCalendar=Tue *-*-* 19..22:00:00
OnCalendar=Mon..Fri 17..22:00:00
OnCalendar=Sat,Sun *-*-* *:00:00
#OnCalendar=Mon..Wed,Fri *-*-* 7..11:00:00
#OnCalendar=Thu *-*-* 13..16:00:00
#OnCalendar=Mon..Fri *-*-* 7..11:00:00
OnCalendar=Mon..Fri 9..11,14..16,0..5:00:00
# Vacation
#OnCalendar=*-*-* *:00:00
[Install]
WantedBy=timers.target
journalctl -u myjob.timer
-- Journal begins at Sat 2021-07-17 23:10:23 CEST, ends at Tue 2021-08-10 20:04:44 CEST. --
Aug 09 18:08:10 citadel systemd[1]: Starting MyJob execution file (for timer)...
Aug 09 18:23:18 citadel systemd[1]: myjob.service: Deactivated successfully.
Aug 09 18:23:18 citadel systemd[1]: Finished MyJob execution file (for timer).
Aug 09 18:23:18 citadel systemd[1]: myjob.service: Consumed 2min 36.218s CPU time.
Aug 09 19:00:01 citadel systemd[1]: Starting MyJob execution...
Aug 09 19:00:12 citadel systemd[1]: myjob.service: Deactivated successfully.
Aug 09 19:00:12 citadel systemd[1]: Finished MyJob execution.
Aug 09 20:00:01 citadel systemd[1]: Starting MyJob execution...
Aug 09 20:00:12 citadel systemd[1]: myjob.service: Deactivated successfully.
Aug 09 20:00:12 citadel systemd[1]: Finished MyJob execution.
Aug 09 21:10:39 citadel systemd[1]: Starting MyJob execution...
Aug 09 21:23:05 citadel systemd[1]: myjob.service: Deactivated successfully.
Aug 09 21:23:05 citadel systemd[1]: Finished MyJob execution.
Aug 09 21:23:05 citadel systemd[1]: myjob.service: Consumed 1min 54.390s CPU time.
journalctl -u myjob.service
-- Boot 426585dafa434ae39515d981d8768f50 --
Aug 09 22:46:50 citadel systemd[1]: Starting MyJob execution...
Aug 09 22:46:54 citadel systemd[1]: myjob.service: Deactivated successfully.
Aug 09 22:46:54 citadel systemd[1]: Finished MyJob execution.
Aug 10 07:07:13 citadel systemd[1]: Starting MyJob execution...
Aug 10 07:44:00 citadel systemd[1]: Finished MyJob execution.
Aug 10 07:44:58 citadel systemd[1]: myjob.service: Deactivated successfully.
Aug 10 07:44:58 citadel systemd[1]: Stopped MyJob execution.
Aug 10 07:44:58 citadel systemd[1]: myjob.service: Consumed 2min 36.035s CPU time.
Aug 10 17:51:32 citadel systemd[1]: /etc/systemd/system/myjob.service:7: Failed to resolve unit specifiers in +%M): Invalid slot
Aug 10 17:51:32 citadel systemd[1]: myjob.service: Unit configuration has fatal error, unit will not be started.
Aug 10 18:02:16 citadel systemd[1]: /etc/systemd/system/myjob.service:7: Failed to resolve unit specifiers in $(date +%M): Invalid slot
Aug 10 18:02:16 citadel systemd[1]: myjob.service: Unit configuration has fatal error, unit will not be started.
Aug 10 18:02:36 citadel systemd[1]: /etc/systemd/system/myjob.service:7: Ignoring unknown escape sequences: "$(date +\%M)"
Aug 10 18:02:36 citadel systemd[1]: /etc/systemd/system/myjob.service:7: Failed to resolve unit specifiers in $(date +\%M): Invalid slot
Aug 10 18:02:36 citadel systemd[1]: myjob.service: Unit configuration has fatal error, unit will not be started.
Aug 10 18:02:55 citadel systemd[1]: Starting MyJob execution...
Aug 10 18:02:55 citadel systemd[28999]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 18:02:55 citadel systemd[28999]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 18:02:55 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 18:02:55 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 18:02:55 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 18:04:43 citadel systemd[1]: Starting MyJob execution...
Aug 10 18:04:43 citadel systemd[29625]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 18:04:43 citadel systemd[29625]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 18:04:43 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 18:04:43 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 18:04:43 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:25:06 citadel systemd[1]: /etc/systemd/system/myjob.service:7: Failed to resolve unit specifiers in $(date +%%%M): Invalid slot
Aug 10 19:25:06 citadel systemd[1]: myjob.service: Unit configuration has fatal error, unit will not be started.
Aug 10 19:26:08 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:26:08 citadel systemd[31045]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 19:26:08 citadel systemd[31045]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 19:26:08 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 19:26:08 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:26:08 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:26:24 citadel systemd[1]: /etc/systemd/system/myjob.service:7: Failed to resolve unit specifiers in $(date +%%%M): Invalid slot
Aug 10 19:26:24 citadel systemd[1]: myjob.service: Unit configuration has fatal error, unit will not be started.
Aug 10 19:27:04 citadel systemd[31497]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 19:27:04 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:27:04 citadel systemd[31497]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 19:27:04 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 19:27:04 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:27:04 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:27:33 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:27:33 citadel systemd[31705]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 19:27:33 citadel systemd[31705]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 19:27:33 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 19:27:33 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:27:33 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:30:57 citadel systemd[32827]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 19:30:57 citadel systemd[32827]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 19:30:57 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:30:57 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 19:30:57 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:30:57 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:31:33 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:31:33 citadel systemd[33029]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 19:31:33 citadel systemd[33029]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 19:31:33 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 19:31:33 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:31:33 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:31:53 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:31:53 citadel systemd[33141]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 19:31:53 citadel systemd[33141]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 19:31:53 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 19:31:53 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:31:53 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:32:01 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:32:01 citadel systemd[33214]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 19:32:01 citadel systemd[33214]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 19:32:01 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 19:32:01 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:32:01 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:32:18 citadel systemd[33314]: myjob.service: Failed to locate executable if: No such file or directory
Aug 10 19:32:18 citadel systemd[33314]: myjob.service: Failed at step EXEC spawning if: No such file or directory
Aug 10 19:32:18 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:32:18 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=203/EXEC
Aug 10 19:32:18 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:32:18 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:35:29 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:35:29 citadel systemd[1]: myjob.service: Control process exited, code=exited, status=1/FAILURE
Aug 10 19:35:29 citadel systemd[1]: myjob.service: Failed with result 'exit-code'.
Aug 10 19:35:29 citadel systemd[1]: Failed to start MyJob execution.
Aug 10 19:36:06 citadel systemd[1]: Starting MyJob execution...
Aug 10 19:53:59 citadel systemd[1]: myjob.service: Deactivated successfully.
Aug 10 19:53:59 citadel systemd[1]: Finished MyJob execution.
Aug 10 19:53:59 citadel systemd[1]: myjob.service: Consumed 2min 18.386s CPU time.
Aug 10 20:00:01 citadel systemd[1]: Starting MyJob execution...
Aug 10 20:00:06 citadel systemd[1]: myjob.service: Deactivated successfully.
Aug 10 20:00:06 citadel systemd[1]: Finished MyJob execution.
-- Journal begins at Sat 2021-07-17 23:10:23 CEST, ends at Tue 2021-08-10 20:04:44 CEST. --
Aug 09 17:06:35 citadel systemd[1]: /etc/systemd/system/myjob.timer:6: Unknown key name 'OnCalender' in section 'Timer', ignoring.
Aug 09 17:06:35 citadel systemd[1]: /etc/systemd/system/myjob.timer:12: Unknown key name 'OnCalender' in section 'Timer', ignoring.
Aug 09 17:06:35 citadel systemd[1]: /etc/systemd/system/myjob.timer:15: Unknown key name 'OnCalender' in section 'Timer', ignoring.
Aug 09 17:06:35 citadel systemd[1]: /etc/systemd/system/myjob.timer:27: Unknown key name 'OnCalender' in section 'Timer', ignoring.
Aug 09 17:06:35 citadel systemd[1]: myjob.timer: Timer unit lacks value setting. Refusing.
Aug 09 17:07:14 citadel systemd[1]: /etc/systemd/system/myjob.timer:12: Failed to parse calendar specification, ignoring: Tue..Fri 17-22:00:00
Aug 09 18:03:59 citadel systemd[1]: Started Timer for myjob WITHOUT asynchronously execution.
Aug 09 18:04:59 citadel systemd[1]: myjob.timer: Deactivated successfully.
Aug 09 18:04:59 citadel systemd[1]: Stopped Timer for myjob WITHOUT asynchronously execution.
Aug 09 18:04:59 citadel systemd[1]: Stopping Timer for myjob WITHOUT asynchronously execution.
Aug 09 18:04:59 citadel systemd[1]: Started Timer for myjob WITHOUT asynchronously execution.
Aug 09 18:05:29 citadel systemd[1]: myjob.timer: Deactivated successfully.
Aug 09 18:05:29 citadel systemd[1]: Stopped Timer for myjob WITHOUT asynchronously execution.
Aug 09 18:05:29 citadel systemd[1]: Stopping Timer for myjob WITHOUT asynchronously execution.
Aug 09 18:05:29 citadel systemd[1]: Started Timer for myjob WITHOUT asynchronously execution.
Aug 09 18:31:24 citadel systemd[1]: myjob.timer: Deactivated successfully.
Aug 09 18:31:24 citadel systemd[1]: Stopped Timer for MyJob WITHOUT asynchronously execution.
Aug 09 18:31:24 citadel systemd[1]: Stopping Timer for MyJob WITHOUT asynchronously execution.
Aug 09 18:31:24 citadel systemd[1]: Started Timer for MyJob WITHOUT asynchronously execution.
Aug 09 18:33:27 citadel systemd[1]: myjob.timer: Deactivated successfully.
Aug 09 18:33:27 citadel systemd[1]: Stopped Schedule for MyJob.
Aug 09 18:33:27 citadel systemd[1]: Stopping Schedule for MyJob.
Aug 09 18:33:27 citadel systemd[1]: Started Schedule for MyJob.
Aug 09 21:26:32 citadel systemd[1]: myjob.timer: Deactivated successfully.
Aug 09 21:26:32 citadel systemd[1]: Stopped Schedule for MyJob.
-- Boot 087af4a7c99c4f15bbec4189ed8663ac --
Aug 09 21:26:38 citadel systemd[1]: Started Schedule for MyJob.
Aug 09 21:30:08 citadel systemd[1]: myjob.timer: Deactivated successfully.
Aug 09 21:30:08 citadel systemd[1]: Stopped Schedule for MyJob.
The answering didn’t work properly, sorry.