On 22/03/2021 14:08, Ed Greshko wrote:
But, when testing things I like to use examples which use simple system commands. To verify that things work as I think they should in various ways before trying my commands/scripts.
Along those lines....
[egreshko@f33k ~]$ cat /etc/systemd/system/mycron.timer [Unit] Description=Test Cron
[Timer] OnCalendar=*:00/10 Persistent=True
[Install] WantedBy=timers.target
[egreshko@f33k ~]$ cat /etc/systemd/system/mycron.service [Unit] Description=Testing myCron
[Service] Type=oneshot #ExecStart=/usr/bin/touch /var/tmp/auto/myCron ExecStart=/usr/bin/systemd-inhibit --who=ME --why=whynot /usr/bin/sleep 300
And when the time arrives
[root@f33k system]# date Mon Mar 22 07:20:05 PM CST 2021
[root@f33k system]# systemctl status mycron.timer ● mycron.timer - Test Cron Loaded: loaded (/etc/systemd/system/mycron.timer; enabled; vendor preset: di> Active: active (running) since Mon 2021-03-22 19:00:42 CST; 19min ago Trigger: n/a Triggers: ● mycron.service
Mar 22 19:00:42 f33k.greshko.com systemd[1]: Started Test Cron.
[root@f33k system]# ps -eaf | grep 300 root 1305 1 0 19:20 ? 00:00:00 /usr/bin/systemd-inhibit --who=ME --why=whynot /usr/bin/sleep 300 root 1308 1305 0 19:20 ? 00:00:00 /usr/bin/sleep 300
[root@f33k system]# systemd-inhibit --list WHO UID USER PID COMM WHAT WHY > ME 0 root 1305 systemd-inhibit shutdown:sleep:idle whynot > ModemManager 0 root 577 ModemManager sleep ModemManager nee> NetworkManager 0 root 703 NetworkManager sleep NetworkManager n> UPower 0 root 598 upowerd sleep Pause device pol>
4 inhibitors listed.