Saya menguji timer systemd dan mencoba untuk mengganti batas waktu default-nya, tetapi tidak berhasil. Saya bertanya-tanya apakah ada cara untuk meminta systemd memberi tahu kami kapan layanan akan dijalankan selanjutnya.
File normal ( /lib/systemd/system/snapbackend.timer
):
# Documentation available at:
# https://www.freedesktop.org/software/systemd/man/systemd.timer.html
[Unit]
Description=Run the snapbackend service once every 5 minutes.
[Timer]
# You must have an OnBootSec (or OnStartupSec) otherwise it does not auto-start
OnBootSec=5min
OnUnitActiveSec=5min
# The default accuracy is 1 minute. I'm not too sure that either way
# will affect us. I am thinking that since our computers will be
# permanently running, it probably won't be that inaccurate anyway.
# See also:
# http://stackoverflow.com/questions/39176514/is-it-correct-that-systemd-timer-accuracysec-parameter-make-the-ticks-slip
#AccuracySec=1
[Install]
WantedBy=timers.target
# vim: syntax=dosini
File override ( /etc/systemd/system/snapbackend.timer.d/override.conf
):
# This file was auto-generated by snapmanager.cgi
# Feel free to do additional modifications here as
# snapmanager.cgi will be aware of them as expected.
[Timer]
OnUnitActiveSec=30min
Saya menjalankan perintah berikut dan timer masih berdetak setiap 5 menit. Mungkinkah ada bug di systemd?
sudo systemctl stop snapbackend.timer
sudo systemctl daemon-reload
sudo systemctl start snapbackend.timer
Jadi saya juga bertanya-tanya, bagaimana saya bisa tahu kapan timer akan berdetak selanjutnya? Karena itu akan segera memberi tahu saya apakah dalam 5 menit. atau 30 menit. tetapi dari systemctl status snapbackend.timer
mengatakan apa-apa tentang itu. Hanya ingin tahu apakah ada perintah yang akan memberi tahu saya penundaan yang saat ini digunakan.
Bagi mereka yang tertarik, ada file layanan juga ( /lib/systemd/system/snapbackend.service
), meskipun saya akan membayangkan bahwa ini seharusnya tidak berpengaruh pada kutu waktu ...
# Documentation available at:
# https://www.freedesktop.org/software/systemd/man/systemd.service.html
[Unit]
Description=Snap! Websites snapbackend CRON daemon
After=snapbase.service snapcommunicator.service snapfirewall.service snaplock.service snapdbproxy.service
[Service]
# See also the snapbackend.timer file
Type=simple
WorkingDirectory=~
ProtectHome=true
NoNewPrivileges=true
ExecStart=/usr/bin/snapbackend
ExecStop=/usr/bin/snapstop --timeout 300 $MAINPID
User=snapwebsites
Group=snapwebsites
# No auto-restart, we use the timer to start once in a while
# We also want to make systemd think that exit(1) is fine
SuccessExitStatus=1
Nice=5
LimitNPROC=1000
# For developers and administrators to get console output
#StandardOutput=tty
#StandardError=tty
#TTYPath=/dev/console
# Enter a size to get a core dump in case of a crash
#LimitCORE=10G
[Install]
WantedBy=multi-user.target
# vim: syntax=dosini
systemctl list-timers
bantuan?