new API for alarm; add `cmd` for the first argument of callback