Startup timer utility7/13/2023 ![]() That is, one can set a command to run at a specified time without having a service file. One can use systemd-run to create transient. Add the option AccuracySec=1us to the section, to avoid the inaccuracy of the 1m default value of AccuracySec.The RandomizedDelaySec option in the section avoids this problem by randomly staggering the start time of each timer. Timers sharing start events can cause poor system performance if the timers' services compete for system resources. Special event expressions like daily and weekly refer to specific start times and thus any timers sharing such calendar events will start simultaneously.The faketime command is especially useful to test various scenarios with the above command it comes with the libfaketime package.For example, one can use systemd-analyze calendar weekly or systemd-analyze calendar "Mon,Tue *-*-01.04 12:00:00". OnCalendar time specifications can be tested in order to verify their validity and to calculate the next time the condition would elapse when used on a timer unit file with the calendar option of the systemd-analyze utility.More information is available in systemd.time(7). In the example below, the service runs at 22:30 on weekdays and at 20:00 on weekends. To run a service at different times, OnCalendar may be specified more than once. If you want something to run every day at 4am, use: When using the DayOfWeek part, at least one weekday has to be specified. To run a service on the first Saturday of every month, use: In the below example the service is run the first four days of each month at 12:00 PM, but only if that day is a Monday or a Tuesday. When more specific dates and times are required, OnCalendar events uses the following format:ĭayOfWeek Year-Month-Day Hour:Minute:SecondĪn asterisk may be used to specify any value and commas may be used to list possible values. When activated, it triggers the service immediately if it missed the last start time (option Persistent=true), for example due to the system being powered off: The following examples schedule foo.service to be run with a corresponding timer called foo.timer.Ī timer which will start 15 minutes after boot and again every week while the system is running.Ī timer which starts once a week (at 12:00am on Monday). If deleted, they will be reconstructed on the next start of their timer.Ī service unit file can be scheduled with a timer out-of-the-box. ![]() These are zero length files which mark the last time each timer was run. If a timer gets out of sync, it may help to delete its stamp-* file in /var/lib/systemd/timers (or ~/.local/share/systemd/ in case of user timers). ![]() The status of a service started by a timer will likely be inactive unless it is currently being triggered. ![]()
0 Comments
Leave a Reply. |