Closed a-detiste closed 9 years ago
This should be possible through the DBus api. I will investigate...
For reference:
static int list_timers(sd_bus *bus, char **args)
static int output_timers_list(struct timer_info *timer_infos, unsigned n)
I have started to implement this. The next elapse of a timer can be fetched through dbus using the NextElapseUSecMonotonic property for monotonic timers and NextElapseUSecRealtime for calendar timers.
However, the output of systemctl list-timers
is not consistent with what I fetch through dbus and what is specified in the unit file. The only timer unit I have is systemd-tmpfiles-clean.timer and for that timer systemctl outputs:
NEXT LEFT LAST PASSED UNIT ACTIVATES
Fri 2015-03-06 04:38:57 CET 9h left Wed 2015-03-04 13:35:29 CET 1 day 5h ago systemd-tmpfiles-clean.timer systemd-tmpfiles-clean.service
According to the unit file this timer should be activated 15min after boot and then every 24h. So NEXT should always be exactly 24h after LAST, and that is also what I fetch through dbus.
Do you experience the same on your system?
If you are using a laptop with suspend, the OnUnitActiveSec=1d
timer stops counting time when the PC is off.
Ah ok, that would explain it. Thanks. Then we need to figure out how to find the total time the system has been suspended and add that to the values fetched through dbus...
get_next_elapse()
gets the raw data, then they are reprocessed thourgh calc_next_elapse()
I would have been easier (better ?) for you if all these computations were on the other side of the Dbus; now you'd have to re-implement everything :-( or maybe some of this code could be shared in libsystemd .
See a80cbdc2e25b8f8e34376ee605dcb89f1a2ff32b
Currently only supports monotonic timers. Can you test if your timer units display the correct NEXT and LAST.
systemd-tmpfiles-clean.timer is OK.
for the rest LAST is missing if timer has not elapsed since last boot; NEXT is allways set to system boot time
How are the cron timers set up, i.e. which of the OnActiveSec, OnBootSec, OnStartupSec, OnUnitActiveSec, OnUnitInactiveSec and OnCalendar settings do they use in their unit files? And what are the values?
they are all setup this way, with OnCalendar=hourly|daily|weekly|monthly; to get anacron-like behaviour
[Timer]
Persistent=true
OnCalendar=
*(well cron-daily.timer is overiden to start at 6h17 )
cron-php5-root-0.timer is dynamicaly translated from this:
# Look for and purge old sessions every 30 minutes
09,39 * * * * root [ -x /usr/lib/php5/sessionclean ] && /usr/lib/php5/sessionclean
to this: OnCalendar=*-*-* *:9,39:00
With 8da3289baa7066809a36262a2e034001daf96e15, calendar-based timers display next and past time points correctly on my system now. Can you test?
:smile: impressive !
only bit missing is last execution of Persistent=true
task that ran last monday & last first day of month
LastTriggerUSec
systemctl sortby Next
column
Commited in eb700ae02468e635a550ab439200f9fa3c7ed4d8
Nice catch finding the undocumented LastTriggerUSec property ;)
@a-detiste I added user timers to the timers tab. As you suggested I used an icon to differentiate between user and system timers. What do you think? :)
it's nice; but I don't grasp the icon choice for system units QIcon::fromTheme("object-locked");
why not use somme standard gear icon ?
I actually tried to find a gear, but couldn't find one in the breeze icon set...
It's called applications-system
, but in Breeze it is replaced by some dots/electrons thing
Oxygen
breeze
Adwaita
mono
Ok, I guess the levers make more sense than a padlock. I will change it...
indeed, it's now ok in the quickgit repo
so this issue & #17 are done and can be closed ?
Yeah, I think we can close this issue now. I want to implement some right-click actions for the timers, but I'm busy with other things right now...
I propose to help on this; users with only
systemd-tmpfiles-clean.timer
wouldn't care about this.I know the timer units are already listed in the
Units
tab, but this would allow for special handling of timers.I also plan to make a plasmoid that display the upcoming events.