Hello, Fedora users,
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.
In previous fedora distros, making it run across reboots was enabled by adding an entry in /etc/rc.local.
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.
regards, Kevin
On 08/08/14 17:28, 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.
In previous fedora distros, making it run across reboots was enabled by adding an entry in /etc/rc.local.
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.
Yes, Fedora does support an rc.local concept....
From
http://docs.fedoraproject.org/en-US/Fedora/16/html/Release_Notes/sect-Releas...
3.2.4. rc.local no longer packaged The /etc/rc.d/rc.local local customization script is no longer included by default. Administrators who need this functionality merely have to create this file, make it executable, and it will run on boot.
Hi, Thanks a lot! Should it have #!/bin/bash as its first line ?
Kevin
On Fri, Aug 8, 2014 at 12:33 PM, Ed Greshko ed.greshko@greshko.com wrote:
On 08/08/14 17:28, 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.
In previous fedora distros, making it run across reboots was enabled by adding an entry in /etc/rc.local.
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.
Yes, Fedora does support an rc.local concept....
From
http://docs.fedoraproject.org/en-US/Fedora/16/html/Release_Notes/sect-Releas...
3.2.4. rc.local no longer packaged The /etc/rc.d/rc.local local customization script is no longer included by default. Administrators who need this functionality merely have to create this file, make it executable, and it will run on boot.
-- If you can't laugh at yourself, others will gladly oblige. -- users mailing list users@lists.fedoraproject.org To unsubscribe or change subscription options: https://admin.fedoraproject.org/mailman/listinfo/users Fedora Code of Conduct: http://fedoraproject.org/code-of-conduct Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines Have a question? Ask away: http://ask.fedoraproject.org
Allegedly, on or about 08 August 2014, Kevin Wilson sent:
Should it have #!/bin/bash as its first line ?
My older Fedora install has #!/bin/sh as its first line in the rc.local file. Not sure if it really is using a lighter weight shell (which sounds like a good idea), or one is aliased to the other, on my system.
On 08/08/2014 12:51 PM, Tim wrote:
Allegedly, on or about 08 August 2014, Kevin Wilson sent:
Should it have #!/bin/bash as its first line ?
My older Fedora install has #!/bin/sh as its first line in the rc.local file. Not sure if it really is using a lighter weight shell (which sounds like a good idea), or one is aliased to the other, on my system.
aliased
ls -l /bin/sh /bin/sh -> bash
On 08/08/2014 09:51 AM, Tim issued this missive:
Allegedly, on or about 08 August 2014, Kevin Wilson sent:
Should it have #!/bin/bash as its first line ?
My older Fedora install has #!/bin/sh as its first line in the rc.local file. Not sure if it really is using a lighter weight shell (which sounds like a good idea), or one is aliased to the other, on my system.
/bin/sh is a symlink to /bin/bash. If bash is started as /bin/sh, then it tries to mimic sh's startup mechanisms as close as possible while remaining POSIX-compliant. Generally speaking, you can use them interchangeably. The differences in operation are fairly minor (the order in which some compound statements are evaluated for example), although they can bite you on occasion.
Startup shell scripts were historically written in sh (a.k.a. Bourne shell) since that was the only shell you were _guaranteed_ to have on a Unix system (BSD- or SVR3/4-derived). csh and ksh were optional, csh originally only being available on BSD-derived systems.
bash (Bourne Again shell) was written to enhance and work around some shortcomings in the original Bourne shell and to move some of the more commonly used commands inside the shell rather than having to call external binaries. ---------------------------------------------------------------------- - Rick Stevens, Systems Engineer, AllDigital ricks@alldigital.com - - AIM/Skype: therps2 ICQ: 22643734 Yahoo: origrps2 - - - - "Daddy, why doesn't this magnet pick up this floppy disk?" - ----------------------------------------------------------------------
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.
On 08/09/14 03:44, Joe Zeff wrote:
On 08/08/2014 02:28 AM, Kevin Wilson wrote:
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.
systemctl enable rc-local.service
No need....
See the notes in the service file...
# This unit gets pulled automatically into multi-user.target by # systemd-rc-local-generator if /etc/rc.d/rc.local is executable.
As explained in the release notes of an earlier version of Fedora. All you need to do is create the /etc/rc.d/rc.local file and make it executable.