None of the action types described in tmpfiles.d(5) seems to allow for running a command as part of creating a temporary file. It is possible to write an argument to a file, for example with action 'w', but not run fortune > /etc/motd.

Since the recommended way to generate tmp files in Arch Linux is tmpfiles.d, I figure there's a way to do it without resorting to systemd/rc.local hacks.


Create a normal .service unit and make it run on boot.

ExecStart=/bin/sh -c "fortune > /etc/motd"

There is no special method for that; writing dynamic contents into a config file is out of scope for tmpfiles.d.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.