Re: How to run a script before shutdown?
Hi,
On Sun, 13 Nov 2016 20:34:38 +0100
Robert Latest <boblatest@gmail.com> wrote:
> Hi all,
>
> I want to automatically start a data backup script (to USB or network
> drive) at each shutdown of my computer. I did some research into this
> and found that several people have the same problem as I do. But the
> threads I found petered out into discussions of several ways of doing
> this, working for some people and not for others. So here I am
> wondering if there is a canonical, proper and reliable method of doing
> this.
probably not the "canonical" way, but still works:
I have a script in /etc/init.d/mystuff for a similar task, that looks
basically like
case "$1" in
start)
printf "/usr/sbin/ntpdate-debian -s -b -p 8 -u de.pool.ntp.org" | at now + 2 minutes
;;
stop)
RUNL=`/sbin/runlevel`
case ${RUNL:2:3} in 0)
/usr/local/sbin/sys-backup;;
esac
;;
esac
Regards
Michael
.-.. .. ...- . .-.. --- -. --. .- -. -.. .--. .-. --- ... .--. . .-.
Humans do claim a great deal for that particular emotion (love).
-- Spock, "The Lights of Zetar", stardate 5725.6
Reply to: