Re: Preventing the computer from shutting down.
On Thu, 30 Oct 2014, Mario Castelán Castro wrote:
> I can set up a script for backup with cron or anacron, but how can I
> prevent the computer from shutting down while the backup is being
> performed so as to not to leave it incomplete?.
If you're using systemd, this can be done using systemd-inhibit. See
http://www.freedesktop.org/software/systemd/man/systemd-inhibit.html
for details.
Quickly:
systemd-inhibit --who='backup script' --why='backup is running currently' \
--mode=block yourbackupscript;
Otherwise, you can add in an init scripts which runs in rc6 and rc0, and
blocks until the backup is done. That's kind of hacky, but should work.
--
Don Armstrong http://www.donarmstrong.com
I cannot find rest
Because I am powerless
To amend a broken world.
-- Guy Gavriel Kay _Under Heaven_ p295
Reply to: