LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-08-2008, 12:31 PM   #1
CrashedAgain
Member
 
Registered: Jan 2004
Posts: 307

Rep: Reputation: 33
shutdown script


I have added some commands which are executed on startup by editing /etc/init.d/bootmisc.sh.

Now I want to add some commands to be executed on shutdown. How do I do this?

Specifically, I want to copy my .mail folder, my bookmarks folder and my addresses folder to a backup partition each time the computer is shut down. Then, about once a week (or perhaps every other week) I want to copy some other files to a backup location.

Thanks
 
Old 04-08-2008, 01:46 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Mineral, Virginia
Distribution: Debian 8
Posts: 7,891

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
What distribution are you using?

-----------------
Steve Stites
 
Old 04-08-2008, 02:37 PM   #3
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914Reputation: 914
Quote:
Originally Posted by CrashedAgain View Post
I have added some commands which are executed on startup by editing /etc/init.d/bootmisc.sh.

Now I want to add some commands to be executed on shutdown. How do I do this?

Specifically, I want to copy my .mail folder, my bookmarks folder and my addresses folder to a backup partition each time the computer is shut down. Then, about once a week (or perhaps every other week) I want to copy some other files to a backup location.

Thanks

Most distros use a rcX.d structure these days. Make your
shutdown script, and stick a symlink in rc0.d and rc6.d,
with a KXX-name ...


Cheers,
Tink
 
Old 04-08-2008, 04:44 PM   #4
CrashedAgain
Member
 
Registered: Jan 2004
Posts: 307

Original Poster
Rep: Reputation: 33
Quote:
Originally Posted by jailbait View Post
What distribution are you using?

-----------------
Steve Stites
Sorry, should have put that in the original post

Debian Etch upgraded to sid.
 
Old 04-08-2008, 05:48 PM   #5
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Mineral, Virginia
Distribution: Debian 8
Posts: 7,891

Rep: Reputation: 338Reputation: 338Reputation: 338Reputation: 338
Debian is one of the distributions which use the rcX.d structure for init levels as Tinkster said. /etc/rc0.d contains symbolic links to scripts executed at halt and /etc/rc6.d contains scripts executed at reboot. Create your scripts someplace where you won't lose them when you do a reinstall and put symbolic links in /etc/rc0.d and /etc/rc6.d to your scripts.

The scripts in these folder are run in alphabetic order. You will need to put your scripts near or at the beginning. If you put them at the end the machine will halt or reboot without executing your scripts.

--------------------
Steve Stites
 
Old 04-08-2008, 06:16 PM   #6
CrashedAgain
Member
 
Registered: Jan 2004
Posts: 307

Original Poster
Rep: Reputation: 33
Thanks..got it working...may need some help with the script later, though.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
script shutdown djaac Programming 2 01-24-2007 08:01 AM
where is shutdown script ashiers Linux - General 8 07-01-2006 05:18 PM
script at the shutdown dominant SUSE / openSUSE 4 10-15-2005 08:43 AM
shutdown script acidjuice Slackware 3 04-09-2005 06:19 PM
Shutdown script Hexane Mandriva 7 01-28-2005 02:36 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:02 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration