Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

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

[Service]
Type=oneshot
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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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