How to restore the accidentally deleted/sbin/service from centos

Source: Internet
Author: User

How to restore the accidentally deleted/sbin/service from centos
When executing the rm command, I accidentally deleted the very important System service Startup command/sbin/service by mistake. So I searched the internet and couldn't find any related articles.
The solutions provided after consulting with senior O & M personnel are as follows:
First, run the yum and rpm command to check the related software packages.
[Html] view plaincopy

  1. # Yumlist | grepinitscripts
  2. Initscripts.x86_649.03.31-2.el6.centos@anaconda-CentOS-201207061011.x86 _ 64/6. 3
  3. Initscripts. x86_649.03.40-2.el6.centos.1updates
The yum source version for software installation is provided above.
[Html] view plaincopy
  1. # Rpm-qa | grepinitscripts
  2. Initscripts-9.03.31-2.el6.centos.x86_64
The preceding figure shows the initscripts already installed in the system. Because the service file is deleted by mistake, an error is displayed, and then run
[Html] view plaincopy
  1. # Yuminstallinitscripts
  2. Loadedplugins: fastestmirror
  3. Loadingtransferspeedsfromcachedhostfile
  4. * Base: mirrors.btte.net
  5. * Extras: mirrors.btte.net
  6. * Updates: mirrors.btte.net
  7. SettingupInstallProcess
  8. ResolvingDependencies
  9. --> Runningtransactioncheck
  10. ---> Packageinitscripts. x86_640: 9.03.31-2. el6.centoswillbeupdated
  11. ---> Packageinitscripts. x86_640: 9.03.40-2. el6.centos. 1 willbeanupdate
  12. --> FinishedDependencyResolution
  13. DependenciesResolved
  14. ========================================================== ========================================================== ========================================================== ========================================================== ========================
  15. PackageArchVersionRepositorySize
  16. ========================================================== ========================================================== ========================================================== ========================================================== ========================
  17. Updating:
  18. Initscriptsx86_649.03.40-2.el6.centos.1updates940k
  19. TransactionSummary
  20. ========================================================== ========================================================== ========================================================== ========================================================== ========================
  21. Upgrade1Package (s)
  22. Totaldownloadsize: 940 k
  23. # Enter y here
  24. Isthisok [y/N]: y
  25. DownloadingPackages:
  26. Initscripts-9.03.40-2.el6.centos.1.x86_64.rpm | 940kB00: 00
  27. Runningrpm_check_debug
  28. RunningTransactionTest
  29. TransactionTestSucceeded
  30. RunningTransaction
  31. Updating: initscripts-9.03.40-2.el6.centos.1.x86_641/2
  32. Cleanup: initscripts-9.03.31-2.el6.centos.x86_642/2
  33. Verifying: initscripts-9.03.40-2.el6.centos.1.x86_641/2
  34. Verifying: initscripts-9.03.31-2.el6.centos.x86_642/2
  35. Updated:
  36. Initscripts. x86_640: 9.03.40-2. el6.centos. 1
  37. Complete!

After the installation is complete, it is found that the service already exists in the/sbin directory.
[Html] view plaincopy
  1. # Ll/sbin/service
  2. -Rwxr-xr-x1rootroot1694Feb2018: 44/sbin/service
  3. # Rpm-qa | grepinitscripts
  4. Initscripts-9.03.40-2.el6.centos.1.x86_64
The software has made a minor version update. This is a real surprise.

Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.