Temporarily prevent linux from shutting down

前端 未结 6 2052
暖寄归人
暖寄归人 2021-01-11 14:06

I have a backup script that runs in the background daily on my linux (Fedora 9) computer. If the computer is shut down while the backup is in progress the backup may be dama

6条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-11 14:32

    Another get-you-started solution: During shutdown, the system runs the scripts in /etc/init.d/ (or really, a script in /etc/rc.*/, but you get the idea.) You could create a script in that directory that checks the status of your backup, and delays shuts down until the backup completes. Or better yet, it gracefully interrupts your backup.

    The super-user could workaround this script (with /sbin/halt for example,) but you can not prevent the super-user for doing anything if their mind is really set into doing it.

提交回复
热议问题