Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a script that needs to be run when os boots up. I added it to /etc/rc.local. It was working fine for sometime but now rc.local does not load at boot time.

When i checked the permissions on the file,

[root@localhost etc]# ls -al rc.local 
-rw-rw-rw-. 1 root root 288 Mar 14 12:40 rc.local

So I used chmod a+x rc.local to set executable permission. But on reboot it didn't start. Again, ls -al rc.local showed that rc.local doesn't have executable permission.

Why did it get reset? How to make rc.local executable permanantly?

Update : Ok, so I did chmod u+x rc.local and now when the os boots up, the file is displayed as having executable permission. But still it isn't getting executed.

Ouput of ls -lZ

[root@localhost etc]# ls -lZ rc.local 
-rwxrw-rw-. root root unconfined_u:object_r:etc_t:s0   rc.local
share|improve this question
1  
There is a . after the permissions in the ls output which indicates that the file has an selinux context. Can you add the output of ls -lZ rc.local to your question? –  Flup Mar 14 '13 at 15:11
    
@Flup : Thanks for answering. Updated the question. –  aswathi Mar 15 '13 at 4:09
    
which OS you are using ? –  Rahul Patil Mar 15 '13 at 5:23
    
It's a symlink, /etc/rc.local -> rc.d/rc.local. Have you created the target manually in /etc/rc.local? –  Rahul Patil Mar 15 '13 at 5:24
    
Am using CentOS 6.3. I didn't manually create /etc/rc.local. Should I delete it and recreate? –  aswathi Mar 15 '13 at 5:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.