LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 02-04-2018, 12:02 PM   #1
Mad-Max
LQ Newbie
 
Registered: Feb 2018
Distribution: RedHat 7
Posts: 5

Rep: Reputation: Disabled
/etc/rc.d/rc.local will not run at start up


trying to set a command to run at start up. Made a file with the command and added the file to /etc/rc.d/rc.local. I then set /etc/rc.d/rc.local and my command file to execute. I then checked systemctl status rc-local and got this error. All i did to the /etc/rc.d/rc.local file is add the last line to run the command file and i am not sure why it does not seem to have the information it needs or what to put into the file to make it work correctly.

[root@localhost ~]# systemctl status rc-local
● rc-local.service - /etc/rc.d/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2018-02-04 10:35:53 EST; 2h 21min ago

Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 13: [Unit]: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 14: Compatibility: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 17: [Service]: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 19: start: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: /etc/rc.d/rc.local: line 25: [Install]: command not found
Feb 04 10:35:53 localhost.localdomain rc.local[3311]: xset: unable to open display ""
Feb 04 10:35:53 localhost.localdomain systemd[1]: rc-local.service: control process exited, code=exited status=1
Feb 04 10:35:53 localhost.localdomain systemd[1]: Failed to start /etc/rc.d/rc.local Compatibility.
Feb 04 10:35:53 localhost.localdomain systemd[1]: Unit rc-local.service entered failed state.
Feb 04 10:35:53 localhost.localdomain systemd[1]: rc-local.service failed.


[root@localhost ~]# cat /etc/rc.d/rc.local
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.


touch /var/lock/subsys/local
/home/mad-max/Documents/mystartup.bash
[root@localhost ~]#
 
Old 02-04-2018, 12:32 PM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
It looks as if your system is trying to run a systemd service file as a script. The question is what did you do to cause this confusion?

What kind of file is Compatibility? Is it a script or a service file? If it's a service file it should be in /etc/systemd/system with the others, not in /etc/rc.d.

I would start again from the beginning. Create a service file to launch your command, put it with the other service files and leave the scripts directory alone. The text stored in rc.local already indicates that you aren't supposed to use this on your system.
 
Old 02-04-2018, 12:50 PM   #3
Mad-Max
LQ Newbie
 
Registered: Feb 2018
Distribution: RedHat 7
Posts: 5

Original Poster
Rep: Reputation: Disabled
Well what i was trying to do was run a command at start up. I am still new to Linux so i was looking online and was trying to follow a guide on how to do it but was getting that error unlike the person who made the guide. The command i am trying to have ran is "xset led on" I have a led keyboard and just trying to set it up to turn on the lights at start up.
 
Old 02-04-2018, 01:06 PM   #4
Mad-Max
LQ Newbie
 
Registered: Feb 2018
Distribution: RedHat 7
Posts: 5

Original Poster
Rep: Reputation: Disabled
I have an led keyboard and was trying to run the command "xset led on" at start up. I am still new to linux and was following a guide and everything worked until i went to enable rc-local.service.
 
Old 02-04-2018, 01:21 PM   #5
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,140

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
xset should run in your XWindows startup, not the system startup. X may not be running yet.
 
Old 02-04-2018, 01:33 PM   #6
Mad-Max
LQ Newbie
 
Registered: Feb 2018
Distribution: RedHat 7
Posts: 5

Original Poster
Rep: Reputation: Disabled
I am not familiar with XWindows. How would i need to access and set that up to run properly.
 
Old 02-04-2018, 05:24 PM   #7
Mad-Max
LQ Newbie
 
Registered: Feb 2018
Distribution: RedHat 7
Posts: 5

Original Poster
Rep: Reputation: Disabled
Find out if you run gnome-session-properties in command prompt it will pull up the gui for startup applications that i was unable to find in the menu area. In there i was able to add the command to the start up to run when the user logs in.
 
Old 02-05-2018, 01:53 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,573
Blog Entries: 19

Rep: Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452Reputation: 4452
Quote:
Originally Posted by Mad-Max View Post
I am not familiar with XWindows. How would i need to access and set that up to run properly.
In Linux, the graphical desktop is not closely integrated with the underlying system as it is in Windows. X, as it is called, sits loosely on top of Linux like a hat on a head. You don't even need to wear a hat! Server distros don't bother to run X.

Desktop distros usually launch X automatically as the last part of the start-up procedure, so you don't need to know how to launch it yourself. But any graphical programs that you want to run at startup can be put into your personal graphical startup file. What that looks like will depend on which of the many available graphical desktops you are running.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
start up vs rc.local unclesamcrazy Linux - Newbie 4 06-24-2014 09:30 PM
clamd upgradation in remote mach through local mac by script to be run on local mach Narayandutt Programming 3 11-29-2006 10:00 AM
no /etc/rc.d/rc.local in suse? how do I start ... drokmed SUSE / openSUSE 2 10-18-2006 01:25 PM
always have to re-run rc.local calcon Slackware 4 04-02-2005 10:32 AM
rc.local not being run gw1500se Mandriva 6 05-31-2004 02:49 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 09:25 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration