English
Ask Your Question
3

What is the auto-start file like rc.local?

asked 2013-06-15 07:11:50 +0000

Brayden gravatar image

updated 2014-10-01 04:20:21 +0000

mether gravatar image

bright question:F18-X86_64 and XFCE4,What is the auto-start file,like rc.local?

I can use cli to modify the backlight :

#/bin/bash
echo 200 > /sys/class/backlight/intel_backlight/brightness

So I must run this script after started. As you know,when I modifying /sys I must be root. I am a freshman of xfce4.Who can tell me : Which file can do same thing link RHEL's /etc/rc.local ?

edit retag flag offensive close merge delete

Comments

2

Thank you FranciscoD. rc.local is working.You have been a great help .

Brayden ( 2013-06-16 02:03:59 +0000 )edit

No worries. Happy to be able to help :)

FranciscoD_ ( 2013-06-16 03:05:47 +0000 )edit

4 answers

Sort by » oldest newest most voted
2

answered 2013-06-15 10:21:55 +0000

From http://joshua14.homelinux.org/blog/?p=1377

As root:

touch /etc/rc.local
chmod +x /etc/rc.local

Next, open the file for editing:-

vi /etc/rc.local

As this is basically a bash script itself, you need to include the bash interpreter as the first line of the file.

#!/bin/bash

You can now add whatever scripts or commands you like here – they will be run after everything else at your specific run-level has been started. In order for systemd to recognise and use this file, the systemd rc-local.service must be enabled.

systemctl enable rc-local.service

You can check the status of this service with:-

systemctl status rc-local.service
edit flag offensive delete link more

Comments

1

Using touch to create the file is a waste of time; all you need to do is open your favorite editor, put what you need in it and save it as /etc/rc.d/rc.local and then make it executable. (Note the difference in the file's path and name.)

sideburns ( 2015-07-04 19:59:02 +0000 )edit

It is irritating that this is marked as the proper solution. The path to /etc/rc.local is wrong and when you follow the solution you end up a non-working setup. Please mark @lzap answer as proper solution or correct the path to /etc/rc.d/rc.local.

Jürgen Hörmann ( 2016-09-10 12:37:22 +0000 )edit
4

answered 2014-10-17 14:45:11 +0000

lzap gravatar image

The systemd dancing is not really necessary. I am not sure for older Fedoras, but from Fedora 19+ you can simple do this:

touch /etc/rc.d/rc.local
# add bash sheband and your content
chmod +x /etc/rc.d/rc.local

That's it! Systemd has a unit that enables this by default on the next boot. Note the file must be executable and in the rc.d subdirectory.

edit flag offensive delete link more

Comments

thanks for this

Muneer ( 2015-04-06 07:56:02 +0000 )edit

This solution is true

touch /etc/rc.d/rc.local

chmod +x /etc/rc.d/rc.local

Moderator change status of answer, such as first don't work

Eugene Taradayko ( 2015-07-04 19:11:48 +0000 )edit

I don't know if we can change the status, but the answer's right except for an error in the file's name, as you and I have both noted.

sideburns ( 2015-07-04 20:01:03 +0000 )edit

I'm using Fedora 22 and just can't run rc.local. I tried it as /etc/rc.local (like Debian and Slackware), as /etc/rc.d/rc.local, creating a link inside runlevel 5 (default) and enabling it with systemctl.

In this last option I received a message:

Possible reasons for having this kind of units are: 1) A unit may be statically enabled by being symlinked from another unit's .wants/ or .requires/ directory. 2) A unit's purpose may be to act as a helper for some other unit which has a requirement dependency on it. 3) A unit may be started when needed...

and nothing happened...

EdDeAlmeida ( 2016-01-11 01:14:48 +0000 )edit

Check the permissions; mine has execute set; I don't know if it has to be that way, but considering that it's a shell script it would make sense to have it that way. In fact, if you'll look at the other comments on this answer, it's specified that you do so.

sideburns ( 2016-01-11 07:16:00 +0000 )edit
1

answered 2017-07-24 12:48:59 +0000

dylan gravatar image
vim /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
restorecon -v /etc/rc.d/rc.local
systemctl enable rc-local.service
systemctl start rc-local.service
systemctl status rc-local.service
edit flag offensive delete link more

Comments

This is the only correct answer and should have been marked as such! Thanks for taking the time.

pal1 ( 2017-08-21 04:33:02 +0000 )edit
0

answered 2016-06-07 10:00:21 +0000

The systemd dancing is not really necessary. I am not sure for older Fedoras, but from Fedora 19+ you can simple do this:

touch /etc/rc.d/rc.local

add bash sheband and your content

chmod +x /etc/rc.d/rc.local That's it! Systemd has a unit that enables this by default on the next boot. Note the file must be executable and in the rc.d subdirectory.

This answer works like charm..Thanks man

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

[hide preview]

Use your votes!

  • Use the 30 daily voting points that you get!
  • Up-vote well framed questions that provide enough information to enable people provide answers.
  • Thank your helpers by up-voting their comments and answers. If a question you asked has been answered, accept the best answer by clicking on the checkbox on the left side of the answer.
  • Down-voting might cost you karma, but you should consider doing so for incorrect or clearly detrimental questions and answers.

Question Tools

Follow
3 followers

Stats

Asked: 2013-06-15 07:11:50 +0000

Seen: 51,711 times

Last updated: Oct 17 '14