Making rc.local work on F20.

Derrik Walker v2.0 dwalker at doomd.net
Sun Oct 26 01:25:47 UTC 2014


There has been discussion of what it takes to make rc.local work. It 
seems that some people are struggling with it.

There are a couple of important details, but for the most part, It's 
almost trivial, as long as your not missing the important parts.

First thing I did was:

# cd/etc
# echo '$!/bin/bash' > /rc.d/rc.local
# ln -s rc.d/rc.local rc.local # because certain things are just burned 
into my brain.
# chmod 755 rc.d/rc.local
# vi /etc/rc.local

Setting the file permissions and making sure '#!/bin/bash' at the top 
are VERY important.

So, if you are poking around on my system:

# ls -l /etc/rc.local
lrwxrwxrwx. 1 root root 13 Mar  1 13:47 /etc/rc.local -> rc.d/rc.local

# ls -l /etc/rc.d/rc.local
-rwxr-xr-x. 1 root root 376 Jun 26 09:05 /etc/rc.d/rc.local

# cat /etc/rc.local
#!/bin/bash

# Fix the scheduler of the SSD
#
# changed to use deadline per benchmarks:
# http://www.phoronix.com/scan.php?item=linux_316_iosched&page=article
# 2014-06-26    dw2
#
# echo noop > /sys/block/sda/queue/scheduler
echo deadline > /sys/block/sda/queue/scheduler

#
# send an email on a (re)boot
#
echo $(hostname) booted on $(date) | mail -s "$(hostname) boot" root

And as you can see, it works:

# systemctl status rc-local
rc-local.service - /etc/rc.d/rc.local Compatibility
    Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
    Active: active (exited) since Tue 2014-10-07 23:20:39 EDT; 2 weeks 3 
days ago
  Main PID: 1036 (code=exited, status=0/SUCCESS)
    CGroup: /system.slice/rc-local.service

Oct 07 23:20:39 tesla systemd[1]: Started /etc/rc.d/rc.local Compatibility.
Oct 07 23:20:39 tesla sendmail[1036]: s983Kd5f001036: from=root, 
size=244, ...st
Oct 07 23:20:40 tesla sendmail[1036]: s983Kd5f001036: to=root, 
ctladdr=root...y)
Hint: Some lines were ellipsized, use -l to show in full.


# cat /sys/block/sda/queue/scheduler
noop [deadline] cfq

That's it.

Really, all you need is to create a proper shell script in 
/etc/rc.d/rc.local with the correct permissions and it should work.

-- 
-- Derrik

Derrik Walker v2.0, RHCE
dwalker at doomd.net

"Those UNIX guys, they think weird!" -- John C. Dvorak



More information about the users mailing list