Fedora Linux Support Community & Resources Center
  #1  
Old 20th June 2012, 10:07 AM
xxsrobin Offline
Registered User
 
Join Date: Jun 2012
Location: china
Posts: 5
linuxchrome
help:the "/etc/rc.d/rc.local"

hello!

i wan to excute many shells written by self when the fedora 17 start-up.

so ,i create the /etc/rc.d/rc.local file
then chmod +x rc.local

but ,when i reboot , my shells do not work .

hava a look :

the rc.local file
-rwxr-xr-x. 1 root root 53 6月 20 15:39 rc.local

the content of rc.local
#! /bin/bash

sh /home/yin/shell/touchpad.sh
exit $?

what can i do now ???

thanks ~~
Reply With Quote
  #2  
Old 20th June 2012, 11:50 AM
Dutchy Offline
Registered User
 
Join Date: Aug 2011
Posts: 1,068
linuxfirefox
Re: help:the "/etc/rc.d/rc.local"

Have you enabled the service?
PHP Code:
systemctl status rc-local.service
systemctl enable rc
-local.service 
You might also want to check the SELinux label.
Mine is:
PHP Code:
ls -laZ /etc/rc.d/rc.local
-rwxr-xr-xroot root unconfined_u:object_r:etc_t:s0   /etc/rc.d/rc.local 
Reply With Quote
  #3  
Old 20th June 2012, 01:39 PM
xxsrobin Offline
Registered User
 
Join Date: Jun 2012
Location: china
Posts: 5
linuxchrome
Re: help:the "/etc/rc.d/rc.local"

Quote:
Originally Posted by Dutchy View Post
Have you enabled the service?
PHP Code:
systemctl status rc-local.service
systemctl enable rc
-local.service 
You might also want to check the SELinux label.
Mine is:
PHP Code:
ls -laZ /etc/rc.d/rc.local
-rwxr-xr-xroot root unconfined_u:object_r:etc_t:s0   /etc/rc.d/rc.local 

thanks for help
but i still can deal with

have a look

[root@localhost helloworld]# systemctl enable rc-local.service
Warning: unit files do not carry install information. No operation executed.


[root@localhost helloworld]# systemctl status rc-local.service
rc-local.service - /etc/rc.d/rc.local Compatibility
Loaded: loaded (/usr/lib/systemd/system/rc-local.service; static)
Active: failed (Result: exit-code) since Wed, 20 Jun 2012 15:41:06 +0800; 3h 55min ago
Process: 826 ExecStart=/etc/rc.d/rc.local start (code=exited, status=1/FAILURE)
CGroup: name=systemd:/system/rc-local.service

can you tell me why ??

Last edited by xxsrobin; 20th June 2012 at 02:05 PM.
Reply With Quote
  #4  
Old 22nd June 2012, 12:19 PM
Dutchy Offline
Registered User
 
Join Date: Aug 2011
Posts: 1,068
linuxfirefox
Re: help:the "/etc/rc.d/rc.local"

Well the enable commando probably isn't possible because it is a static service (and therefore no need to enable it).
I guess there must be something wrong with your script.
You should test the two individually: first put something really trivial in rc.local (something like "touch /test.txt") so you can be sure rc.local is processed.
If that works then the problem is with your script.
You say it should execute many shells written by self?
Reply With Quote
  #5  
Old 22nd June 2012, 12:38 PM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,994
linuxfirefox
Re: help:the "/etc/rc.d/rc.local"

The command
systemctl restart rc-local.service
should cause you script to run.

Be aware that yo umay not have PATH setup as expecte whe nrc.local runs so use FULL PATHS for commands
Either set PATH or use
/bin/sh /home/yin/shell/touchpad.sh
not
sh /home/yin/shell/touchpad.sh

also in YOUR scripts. This is a security issue too.
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #6  
Old 22nd June 2012, 02:06 PM
smr54 Offline
Registered User
 
Join Date: Jan 2010
Posts: 5,542
linuxfirefox
Re: help:the "/etc/rc.d/rc.local"

A couple of things that people sometimes forget.

The script has to have the #!/bin/sh or #!/bin/bash, or whatever at the VERY top. If there is a space in the first line, like
Code:
#!/bin/sh
it may not run.

(You can't really see the space there, but at any rate, make sure the #!/bin/sh is in the very first line.)

Also be sure you made it executable

chmod 755 /etc/rc.d/rc.local
Reply With Quote
  #7  
Old 22nd June 2012, 02:54 PM
stevea Offline
Registered User
 
Join Date: Apr 2006
Location: Ohio, USA
Posts: 8,994
linuxfirefox
Re: help:the "/etc/rc.d/rc.local"

No - no the extra space makes no difference. The '#!' as the first two chars is important. The rest of the line is just exec'ed with some re-arrangement.

---------- Post added at 08:54 AM ---------- Previous post was at 08:49 AM ----------

example should help ....

Code:
[stevea@crucibulum Desktop]$ ls -l /tmp/foo
-rwxrwxr-x. 1 stevea stevea 44 Jun 22 08:52 /tmp/foo
[stevea@crucibulum Desktop]$ cat /tmp/foo
#!    /usr/bin/cat -n 
line 1
line 2
line 3
[stevea@crucibulum Desktop]$ /tmp/foo
     1	#!    /usr/bin/cat -n 
     2	line 1
     3	line 2
     4	line 3
[stevea@crucibulum Desktop]$
__________________
None are more hopelessly enslaved than those who falsely believe they are free.
Johann Wolfgang von Goethe
Reply With Quote
  #8  
Old 22nd June 2012, 03:59 PM
Skull One Offline
Registered User
 
Join Date: Jun 2010
Location: Lost...
Posts: 1,168
linuxredhatmozilla
Re: help:the "/etc/rc.d/rc.local"

Quote:
the content of rc.local
#! /bin/bash

sh /home/yin/shell/touchpad.sh
exit $?
It is a big security hole to let the system run a user script.
SELinux probably forbid that, so check the audit log, with for instance:
Code:
audit2why < /var/log/audit/audit.log
And the very stupid question: did you test the script before?
__________________
:confused:
Reply With Quote
  #9  
Old 23rd June 2012, 05:21 AM
xxsrobin Offline
Registered User
 
Join Date: Jun 2012
Location: china
Posts: 5
linuxchrome
Re: help:the "/etc/rc.d/rc.local"

thanks for help
now , my rc-local.service is enable.
but,when the content of rc.local is

Code:
#!/bin/bash
echo hello > /home/hello.txt
it is no problem!

however,i alter it like this
Code:
#!/bin/bash
/usr/bin/synclient touchpadoff=1
it failed!

Code:
[root@localhost yin]# cat /var/log/boot.log  | grep rc
         Starting /etc/rc.d/rc.local Compatibility...
[FAILED] Failed to start /etc/rc.d/rc.local Compatibility.
         See 'systemctl status rc-local.service' for details.
[root@localhost yin]# systemctl status rc-local.service
rc-local.service - /etc/rc.d/rc.local Compatibility
	  Loaded: loaded (/etc/systemd/system/rc-local.service; enabled)
	  Active: failed (Result: exit-code) since Sat, 23 Jun 2012 10:56:03 +0800; 52s ago
	 Process: 780 ExecStart=/etc/rc.d/rc.local start (code=exited, status=1/FAILURE)
	  CGroup: name=systemd:/system/rc-local.service

Last edited by xxsrobin; 23rd June 2012 at 05:28 AM.
Reply With Quote
  #10  
Old 23rd June 2012, 12:42 PM
Skull One Offline
Registered User
 
Join Date: Jun 2010
Location: Lost...
Posts: 1,168
linuxredhatmozilla
Re: help:the "/etc/rc.d/rc.local"

I presume it failed because the X server is not yet started when the script is run.

If you want to configure/disable the touchpad, the best way is to use a xorg configuration file, for instance (see https://wiki.archlinux.org/index.php/Touchpad_Synaptics):
/etc/X11/xorg.conf.d/10-synaptics.conf
Code:
 Section "InputClass"
       Identifier "touchpad"
       Driver "synaptics"
       MatchIsTouchpad "on"
              Option "TouchpadOff" "1"
 EndSection
Another way is to use some X specific scripts (xinitrc, Xsession, ...) that are run when the server is started.
__________________
:confused:
Reply With Quote
  #11  
Old 25th June 2012, 04:18 PM
xxsrobin Offline
Registered User
 
Join Date: Jun 2012
Location: china
Posts: 5
linuxchrome
Re: help:the "/etc/rc.d/rc.local"

Quote:
Originally Posted by Skull One View Post
I presume it failed because the X server is not yet started when the script is run.

If you want to configure/disable the touchpad, the best way is to use a xorg configuration file, for instance (see https://wiki.archlinux.org/index.php/Touchpad_Synaptics):
/etc/X11/xorg.conf.d/10-synaptics.conf
Code:
 Section "InputClass"
       Identifier "touchpad"
       Driver "synaptics"
       MatchIsTouchpad "on"
              Option "TouchpadOff" "1"
 EndSection
Another way is to use some X specific scripts (xinitrc, Xsession, ...) that are run when the server is started.
thank for help . i have done.
but this is no "10-synaptics.conf" in /etc/X11/xorg.conf.d

this is a "50-synaptics.conf" in /usr/share/X11/xorg.conf.d

i alter it as
Code:
Section "InputClass"
        Identifier "touchpad catchall"
        Driver "synaptics"
        MatchIsTouchpad "on"
        MatchDevicePath "/dev/input/event*"
           Option "Touchpadoff" "1"
EndSection
................
................
the touchpad is disable when start-up.
Reply With Quote
  #12  
Old 25th June 2012, 04:58 PM
Skull One Offline
Registered User
 
Join Date: Jun 2010
Location: Lost...
Posts: 1,168
linuxredhatmozilla
Re: help:the "/etc/rc.d/rc.local"

Quote:
but this is no "10-synaptics.conf" in /etc/X11/xorg.conf.d

this is a "50-synaptics.conf" in /usr/share/X11/xorg.conf.d
Beware! Files in /usr/share will be override at the next update.
The changes need to be done in /etc to be persistent.
You just have to create the file, it has precedence over files in /usr/share. You can check this the xorg manual.
__________________
:confused:
Reply With Quote
Reply

Tags
helpthe, or etc or rcd or rclocal

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
unpredictable "delete" "move to trash" or "cut" file menu option dorianrenato Using Fedora 1 21st November 2011 04:09 AM
Fedora 10 fails to boot after "Enabling local filesystem quotas" nharvey Alpha, Beta & Snapshots Discussions (Fedora 10 Only) 1 11th November 2008 05:24 PM
"ls" and "cd" treat ".." differently inside symlinked directories bnorman Using Fedora 0 19th June 2008 05:49 PM
HOW TO MOUNT "C" "D" "E" LOCAL HARDDISK PARTITION ketan_hk Using Fedora 6 6th September 2007 02:10 AM
Error:visibility arg must be one of "default", "hidden", "protected" or "internal" wangfeng Using Fedora 0 23rd May 2005 05:59 AM


Current GMT-time: 17:28 (Wednesday, 26-11-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Gohana - Bensonville Travel Photos on Instagram - Braco do Norte Photos on Instagram