run cron every N seconds

Для современных систем есть systemd который прекрасно решает эту задачу оригинальная статься здесь

Цитата:

Here is a simple example that logs "Hello World" every 10 seconds:
/etc/systemd/system/helloworld.service:

[Unit]
Description=Say Hello
[Service]
ExecStart=/usr/bin/logger -i Hello World

/etc/systemd/system/helloworld.timer:
[Unit]
Description=Say Hello every 10 seconds
[Timer]
OnBootSec=10
OnUnitActiveSec=10
AccuracySec=1ms
[Install]
WantedBy=timers.target

After setting up these units (in /etc/systemd/system, as described above, for a system-wide setting, or at ~/.config/systemd/user for a user-specific setup), you need to enable the timer (not the service though) by running systemctl enable helloworld.timer. If you want to start the timer immediately (instead of waiting for it to start after a reboot), also run systemctl start helloworld.timer.

Tags: ,
| 09/01/2020 | Posted in Без рубрики |

Leave a Reply