running a specified binary across reboots

Matthew Miller mattdm at fedoraproject.org
Fri Aug 8 12:16:16 UTC 2014


On Fri, Aug 08, 2014 at 12:28:25PM +0300, Kevin Wilson wrote:
> I want to run a binary of some Fedora application I wrote immediately
> after reboot.
> 
> I know that as a workaround I can wrap it as a systemd daemon, but I
> prefer not to.

You don't need to wrap it in anything -- whatever legitimate complaints
there can be, simply running a binary or script is really easy. You just
need something like:


[Service]
Type=oneshot
ExecStart=/usr/local/bin/whatever

[Install]
WantedBy=default.target

(If this is a long-running daemon, possibly "Type=forking" or "Type=simple"
-- and simple is the default so you can leave that off.)


But as Ed noted, if you don't want to do that, you can use
/etc/rc.d/rc.local.


Or, particularly if you want this to run as a non-root user, you can use
"@reboot" in cron. This replaces all of the other time specifiers, so, like
this:

@reboot /usr/local/bin/whatever

> What is a good practice to achieve it in Fedora 20 ? there is no
> /etc/rc.local in my fedora 20, and trying to add an entry in
> /etc/rc.local does not cause it be be run across boots.

It's a little unfortunate that we don't support the traditional file
location, but, there we are.
-- 
Matthew Miller
<mattdm at fedoraproject.org>
Fedora Project Leader


More information about the users mailing list