Skip to main content
added 4 characters in body
Source Link

I would like to run a script every 30 minutes on my RbPi, but not immediately after boot.
Example: If I boot my RbPi at 15:15, the script runsshould run at 15:30 (notnot before).
Setup: My RbPi has no internet connection to sync its time, it relies on an external RTC. To sync the time I followed this post.

What I did so far:
I have the following two files, generated using
sudo systemctl edit --force --full test.service and
sudo systemctl edit --force --full test.timer

# test.service
[Unit]
Description=test

[Service]
Type=simple
ExecStart=echo "TEST"

# test.timer
[Unit]
Description=test

[Timer]
OnCalendar=*:0/30
Persistent=false

[Install]
WantedBy=default.target

Unfortunately this dummy script runs immediately during the boot sequence as shown by journalctl -r:

...

Oct 21 14:11:43 rbpi0 kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Oct 21 14:11:43 rbpi0 systemd[1]: Finished Online ext4 Metadata Check for All Filesystems.
Oct 21 14:11:43 rbpi0 systemd[1]: e2scrub_all.service: Succeeded.
Oct 21 14:11:43 rbpi0 systemd[1]: Starting Daily man-db regeneration...
Oct 21 14:11:43 rbpi0 systemd-udevd[128]: Using default interface naming scheme 'v247'.
Oct 21 14:11:43 rbpi0 bluetoothd[443]: Starting SDP server
Oct 21 14:11:43 rbpi0 systemd[1]: Starting Rotate log files...
Oct 21 14:11:43 rbpi0 bluetoothd[443]: Bluetooth daemon 5.55
Oct 21 14:11:43 rbpi0 echo[455]: TEST
Oct 21 14:11:43 rbpi0 systemd[1]: Starting test...
Oct 21 14:11:43 rbpi0 systemd[1]: Started Runs the takePicture.py script..
Oct 21 14:11:42 rbpi0 systemd[1]: Starting Online ext4 Metadata Check for All Filesystems...
Oct 21 14:11:42 rbpi0 kernel: rtc-rv3028 1-0052: setting system clock to 2023-10-21T14:11:42 UTC (1697897502)

How can I avoid my script to run during the boot sequence but run only at *:30?

I would like to run a script every 30 minutes on my RbPi, but not immediately after boot.
Example: If I boot my RbPi at 15:15, the script runs at 15:30 (not before).
Setup: My RbPi has no internet connection to sync its time, it relies on an external RTC. To sync the time I followed this post.

What I did so far:
I have the following two files, generated using
sudo systemctl edit --force --full test.service and
sudo systemctl edit --force --full test.timer

# test.service
[Unit]
Description=test

[Service]
Type=simple
ExecStart=echo "TEST"

# test.timer
[Unit]
Description=test

[Timer]
OnCalendar=*:0/30
Persistent=false

[Install]
WantedBy=default.target

Unfortunately this dummy script runs immediately during the boot sequence as shown by journalctl -r:

...

Oct 21 14:11:43 rbpi0 kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Oct 21 14:11:43 rbpi0 systemd[1]: Finished Online ext4 Metadata Check for All Filesystems.
Oct 21 14:11:43 rbpi0 systemd[1]: e2scrub_all.service: Succeeded.
Oct 21 14:11:43 rbpi0 systemd[1]: Starting Daily man-db regeneration...
Oct 21 14:11:43 rbpi0 systemd-udevd[128]: Using default interface naming scheme 'v247'.
Oct 21 14:11:43 rbpi0 bluetoothd[443]: Starting SDP server
Oct 21 14:11:43 rbpi0 systemd[1]: Starting Rotate log files...
Oct 21 14:11:43 rbpi0 bluetoothd[443]: Bluetooth daemon 5.55
Oct 21 14:11:43 rbpi0 echo[455]: TEST
Oct 21 14:11:43 rbpi0 systemd[1]: Starting test...
Oct 21 14:11:43 rbpi0 systemd[1]: Started Runs the takePicture.py script..
Oct 21 14:11:42 rbpi0 systemd[1]: Starting Online ext4 Metadata Check for All Filesystems...
Oct 21 14:11:42 rbpi0 kernel: rtc-rv3028 1-0052: setting system clock to 2023-10-21T14:11:42 UTC (1697897502)

How can I avoid my script to run during the boot sequence but run only at *:30?

I would like to run a script every 30 minutes on my RbPi, but not immediately after boot.
Example: If I boot my RbPi at 15:15, the script should run at 15:30 not before.
Setup: My RbPi has no internet connection to sync its time, it relies on an external RTC. To sync the time I followed this post.

What I did so far:
I have the following two files, generated using
sudo systemctl edit --force --full test.service and
sudo systemctl edit --force --full test.timer

# test.service
[Unit]
Description=test

[Service]
Type=simple
ExecStart=echo "TEST"

# test.timer
[Unit]
Description=test

[Timer]
OnCalendar=*:0/30
Persistent=false

[Install]
WantedBy=default.target

Unfortunately this dummy script runs immediately during the boot sequence as shown by journalctl -r:

...

Oct 21 14:11:43 rbpi0 kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Oct 21 14:11:43 rbpi0 systemd[1]: Finished Online ext4 Metadata Check for All Filesystems.
Oct 21 14:11:43 rbpi0 systemd[1]: e2scrub_all.service: Succeeded.
Oct 21 14:11:43 rbpi0 systemd[1]: Starting Daily man-db regeneration...
Oct 21 14:11:43 rbpi0 systemd-udevd[128]: Using default interface naming scheme 'v247'.
Oct 21 14:11:43 rbpi0 bluetoothd[443]: Starting SDP server
Oct 21 14:11:43 rbpi0 systemd[1]: Starting Rotate log files...
Oct 21 14:11:43 rbpi0 bluetoothd[443]: Bluetooth daemon 5.55
Oct 21 14:11:43 rbpi0 echo[455]: TEST
Oct 21 14:11:43 rbpi0 systemd[1]: Starting test...
Oct 21 14:11:42 rbpi0 systemd[1]: Starting Online ext4 Metadata Check for All Filesystems...
Oct 21 14:11:42 rbpi0 kernel: rtc-rv3028 1-0052: setting system clock to 2023-10-21T14:11:42 UTC (1697897502)

How can I avoid my script to run during the boot sequence but run only at *:30?

Source Link

Run systemd timer periodically but not on boot

I would like to run a script every 30 minutes on my RbPi, but not immediately after boot.
Example: If I boot my RbPi at 15:15, the script runs at 15:30 (not before).
Setup: My RbPi has no internet connection to sync its time, it relies on an external RTC. To sync the time I followed this post.

What I did so far:
I have the following two files, generated using
sudo systemctl edit --force --full test.service and
sudo systemctl edit --force --full test.timer

# test.service
[Unit]
Description=test

[Service]
Type=simple
ExecStart=echo "TEST"

# test.timer
[Unit]
Description=test

[Timer]
OnCalendar=*:0/30
Persistent=false

[Install]
WantedBy=default.target

Unfortunately this dummy script runs immediately during the boot sequence as shown by journalctl -r:

...

Oct 21 14:11:43 rbpi0 kernel: Bluetooth: BNEP (Ethernet Emulation) ver 1.3
Oct 21 14:11:43 rbpi0 systemd[1]: Finished Online ext4 Metadata Check for All Filesystems.
Oct 21 14:11:43 rbpi0 systemd[1]: e2scrub_all.service: Succeeded.
Oct 21 14:11:43 rbpi0 systemd[1]: Starting Daily man-db regeneration...
Oct 21 14:11:43 rbpi0 systemd-udevd[128]: Using default interface naming scheme 'v247'.
Oct 21 14:11:43 rbpi0 bluetoothd[443]: Starting SDP server
Oct 21 14:11:43 rbpi0 systemd[1]: Starting Rotate log files...
Oct 21 14:11:43 rbpi0 bluetoothd[443]: Bluetooth daemon 5.55
Oct 21 14:11:43 rbpi0 echo[455]: TEST
Oct 21 14:11:43 rbpi0 systemd[1]: Starting test...
Oct 21 14:11:43 rbpi0 systemd[1]: Started Runs the takePicture.py script..
Oct 21 14:11:42 rbpi0 systemd[1]: Starting Online ext4 Metadata Check for All Filesystems...
Oct 21 14:11:42 rbpi0 kernel: rtc-rv3028 1-0052: setting system clock to 2023-10-21T14:11:42 UTC (1697897502)

How can I avoid my script to run during the boot sequence but run only at *:30?