Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #174688

Re: How to run a script before shutdown?

From Michael Lange <klappnase@freenet.de>
Newsgroups linux.debian.user
Subject Re: How to run a script before shutdown?
Date 2016-11-14 11:30 +0100
Message-ID <sDmGu-5IO-9@gated-at.bofh.it> (permalink)
References <sD8Nb-4Dx-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.debian.user | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to run a script before shutdown? Robert Latest <boblatest@gmail.com> - 2016-11-13 20:40 +0100
  Re: How to run a script before shutdown? Sven Joachim <svenjoac@gmx.de> - 2016-11-13 21:30 +0100
    Re: How to run a script before shutdown? Robert Latest <boblatest@gmail.com> - 2016-11-14 18:50 +0100
  Re: How to run a script before shutdown? David Christensen <dpchrist@holgerdanske.com> - 2016-11-14 02:40 +0100
    Re: How to run a script before shutdown? rhkramer@gmail.com - 2016-11-14 13:40 +0100
      Re: How to run a script before shutdown? Jude DaShiell <jdashiel@panix.com> - 2016-11-14 16:30 +0100
        Re: How to run a script before shutdown? rhkramer@gmail.com - 2016-11-14 18:10 +0100
        Re: A_Message_Regarding_Your_DEBT_Situation. vs78 Jude DaShiell <jdashiel@panix.com> - 2016-11-14 22:30 +0100
          Re: A_Message_Regarding_Your_DEBT_Situation. vs78 Lisi Reisz <lisi.reisz@gmail.com> - 2016-11-14 23:20 +0100
            Re: A_Message_Regarding_Your_DEBT_Situation. vs78 Jude DaShiell <jdashiel@panix.com> - 2016-11-16 12:50 +0100
              Re: A_Message_Regarding_Your_DEBT_Situation. vs78 Tony van der Hoff <tony@vanderhoff.org> - 2016-11-16 13:00 +0100
  Re: How to run a script before shutdown? Michael Lange <klappnase@freenet.de> - 2016-11-14 11:30 +0100
    Re: How to run a script before shutdown? Hans <hans.ullrich@loop.de> - 2016-11-14 11:50 +0100

csiph-web