2 minute read Published: 2019-11-21

Roughly every week I learn something that it seems like everyone who's been using Linux for any decent period of time seems to already know, so I'm gonna start writing them down as I discover them. In today's episode, I learned about at, which really tickles the part of me that likes things that just do what they say they do.

echo notify-send "get coffee" | at 4pm

at is kind of like cron except designed for more isolated tasks. It relies on a running daemon called atd, so if you install at through your package manager make sure to do a systemctl enable atd --now or equivalent. You can then start chucking it jobs.

This works great remotely - if you want to have a server restart after everyone's gone home from work, you could do a ssh <machine> 'echo reboot | at 10pm' assuming you have at installed everywhere. I found out about this from its use at GitLab to simultaneously restart a service on a fleet of machines - you can read about that here.

According to the manpage you can do some even cleverer things - you can give it times like at 4pm + 3 days, words like at next friday, or use the batch command to have things run once the system is below a certain load level, great for things like make -j that would otherwise bring a system to a grinding halt.

You can also customise /etc/at.allow and /etc/at.deny to allow/deny certain users from using at.

So, that's at. I didn't know about it until I read that GitLab blog, and now I'm gonna use it because it's useful. I'll echo see you | at next time.