How to recover accidentally deleted /etc/rc.d file or folder?? What is the impact of deleting them?
I have accidentally deleted /etc/rc.d and /etc/rc0.d folders which resulted deletion of init.d and other related folders.
1.What is the use of /etc/rc.d, rc, rc.d, rc0.d, rc1.d, rc2.d.......rc6.d and other files inside /etc/rc.d? 2.If we accidentally delete them how to recover? If we have the same files in other server can we copy and get the situation to normal? 4.Suggest any possible way to minimize the impact or totally resolve this situation. PLEASE HELPP!!! OS DETAILS here Linux version 2.6.32-642.11.1.el6.x86_64 (mockbuild@x86-027.build.eng.bos.redhat.com) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) ) SMP Wed Oct 26 10:25:23 EDT 2016 |
Quote:
Quote:
Code:
yum reinstall chkconfig initscripts Code:
ps -eHocomm|sed -E '1,/^init$/d;/^[ ]{3,}/d'|uniq Code:
pstree Code:
rpm -qf $(rpm -qal|grep ^/etc/rc.d/init.d/.)|sort -u Quote:
Code:
chkconfig --list |
Welcome to LQ.
These are some of the basic questions where one thinks it could be homework, if not homework someone trolling and if totally serious why would you be messing around as root if not totally knowing what you are doing? If really serious the impact is the server will not boot if off or shutdown if running. Call the administrator of the system or some one that knows what they are doing. As posted there are several ways to recovery. If those fail contact Red Hat. |
^ Never thought about that, except that it's a royal f***up to let that happen in any case. But we have seen those on LQ, people do mess up royally! Being root where they don't have to, it happens all the easier.
Anyhow, shruggy's answer is excellent! |
Quote:
As admin of ANY machine Linux/Windows/Mac, one of the basic things for admin duty is backup AND restore procedure. Hopefully you have that documented and tested? If not, as mentioned, reinstall initscripts and figure out which services you need to reinstall. Good luck, and perhaps, stop logging in as root. |
@OP I have another piece of advice for you. The first thing I always do on a newly installed system is installing and configuring etckeeper. On a RedHat-based distro that usually means enabling the EPEL repo first.* Thus, I always have a quick and easy way out of a situation like yours.
____ * Back in August 2019, when the EPEL repo for CentOS 8 was still pretty empty, I was forced to install rpmdevtools first and rebuild etckeeper from Fedora source. |
Thanks @Shruggy, We have a identical server which runs almost same services.
am not sure about what is installing of scripts if they already existed(before deleting). --> yum reinstall chkconfig initscripts I am just a dumb jerky moron couldn't understand all those.. We have same files/folders in the other server.. Can we just copy them to the damaged system? (tried this, but all the links were missing don't know softlinlks/hardlinks/any other links) 1. Can we copy the folders or files (/etc/rc.d and /etc/rc0.d from another server) to get the situation normal? 2. How about the links that were not created automatically after copying the folders/files, is there any way to do them? 3. I understand that there will be no impact unless we do a reboot/restart of the server, am i right? 4. Let's say i copied the folders and created the links with your suggestions, are there any further checks to go ahead for a reboot which doesn't affect anything? 5. Please help with simple/complex steps or commands with clear mentions Please help me @Shruggy @dc.901 @ondoho @michaelk or anyone.. please help!!! |
Quote:
Quote:
Quote:
Quote:
Quote:
|
Basically, all the init scripts for each installed service are in the init.d directory. When configured to run a link is created in the associated rcx.d according to the default settings within the script itself but can be changed via chkconfig.
How are you copying the files/links? If via some flash drive it needs to be using a Linux filesystem using cp -P or a tar file that preserves links. They can be copied over the network using the tools as suggested too. Anyone else have knowledge of how the systems were configured? |
@michelk please guide me on how to copy these files from another server to local, and local to damaged server using FTP/Filezilla because both linux servers don't have connectivity.
Please help me with commands for preserving or copying files/folders with exactly same properties, file ownership, especially softlinks or symlinks and any other properties. |
I guess they are cloud servers, am I right?
|
Yes @Shruggy, They are accessible through citrix only.
|
1 Attachment(s)
Could you revert to a previously taken VM snapshot (see attachment)? You could also take another snapshot now to be able to go back to the current state.
|
Quote:
Or ask your provider to reset the machines - meaning you lose everything. It seems you did not follow shruggy's advice, and, to make it worse, rebooted??? Lessen learned: make backups. |
All times are GMT -5. The time now is 09:23 AM. |