This is kind of scary! I removed /etc/init.d directory! How can I recover this directory? I know that if I restart my computer now I won't see my linux again!
Please advice!
This is kind of scary! I removed /etc/init.d directory! How can I recover this directory? I know that if I restart my computer now I won't see my linux again!
Please advice!
Look at the /etc/rc?.d directories. You will find symlinks in those that point to the scripts that were in /etc/init.d. You will know what startup scripts you will need to restore to /etc/init.d. So, something like:
and you will see something like:
To get a copy of those scripts, do what Martin suggests, or, alternatively, spin up another machine (on a spare computer or in a virtual environment) using the same Linux distro, and copy the relevant /etc/init.d files from there; you may have to install additional packages. The latter might be easier.
After you copy the files, you should run the "ls -l /etc/rc?.d" again. The broken symlinks should now be there. If there are broken links, figure out what packages provide those, etc., install those on the VM, and keep doing this until things look correct.
After that, you're probably going to be OK, though you should be prepared to get console on the machine in case something goes wrong.
Install the same Linux distri in a VM, if you have extra services like Apache etc. install them too, and copy the /etc/init.d directory to your machine.
Maybe you could find developer infrastructure (issue trackers, repositories, ...) for your distribution and checkout the scripts out of there.
This would work for basic init scripts. For various program's init scripts you can either checkout the init scripts for each such program, or simply reinstall appropriate package.