Go Back   HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials > Linux Forums > Desktop Operation

Do you like HowtoForge? Please consider supporting us by becoming a subscriber.
Reply
 
Thread Tools Display Modes
  #1  
Old 25th August 2009, 08:41
dipeshmehta dipeshmehta is offline
Senior Member
 
Join Date: Nov 2008
Location: Rajkot, India
Posts: 173
Thanks: 5
Thanked 13 Times in 13 Posts
Send a message via Yahoo to dipeshmehta Send a message via Skype™ to dipeshmehta
Default how to to run script at shutdown event

Hello all,

I have been using Ubuntu 9.04 Desktop, side by side, with Windows XP (Dual Boot).

I want some of my files/folders at linux partition to be copied to my ntfs partition whenever I shutdown my Ubuntu Desktop. I would create some simple script to run cp commands, how do I tell ubuntu to run those scripts before it shuts down?

Dipesh
Reply With Quote
Sponsored Links
  #2  
Old 25th August 2009, 12:36
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

Use upstart http://upstart.ubuntu.com/
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
  #3  
Old 25th August 2009, 19:18
id10t id10t is offline
Senior Member
 
Join Date: Nov 2008
Posts: 240
Thanks: 2
Thanked 22 Times in 22 Posts
Default

Put your scripts in /etc/rc0.d (shutdown) and /etc/rc6.d (reboot)
Reply With Quote
  #4  
Old 25th August 2009, 19:25
topdog topdog is offline
Senior Member
 
Join Date: Jan 2008
Location: South Africa
Posts: 1,352
Thanks: 0
Thanked 153 Times in 150 Posts
Default

That's incorrect, those directories use symlinks to the actual script is SXX KXX where xx is the number in sequence to run the symlinked script
__________________
----
http://www.topdog.za.net - Got Linux problems ? - I can help.
http://www.baruwa.org - Try it.
Reply With Quote
The Following User Says Thank You to topdog For This Useful Post:
dipeshmehta (27th August 2009)
  #5  
Old 25th August 2009, 21:40
id10t id10t is offline
Senior Member
 
Join Date: Nov 2008
Posts: 240
Thanks: 2
Thanked 22 Times in 22 Posts
Default

Well, you are correct on that. Put the scripts in /etc/init.d and *then* make symlinks to the rc?.d directories, make sure the symlink starts with a S or K (start or kill) and make sure they have a number low enough or high enough to run and do your thing before filesystems get unmounted, etc.



Quote:
Originally Posted by topdog View Post
That's incorrect, those directories use symlinks to the actual script is SXX KXX where xx is the number in sequence to run the symlinked script
Reply With Quote
The Following User Says Thank You to id10t For This Useful Post:
dipeshmehta (27th August 2009)
  #6  
Old 26th August 2009, 09:39
dipeshmehta dipeshmehta is offline
Senior Member
 
Join Date: Nov 2008
Location: Rajkot, India
Posts: 173
Thanks: 5
Thanked 13 Times in 13 Posts
Send a message via Yahoo to dipeshmehta Send a message via Skype™ to dipeshmehta
Default

Quote:
Originally Posted by id10t View Post
Well, you are correct on that. Put the scripts in /etc/init.d and *then* make symlinks to the rc?.d directories, make sure the symlink starts with a S or K (start or kill) and make sure they have a number low enough or high enough to run and do your thing before filesystems get unmounted, etc.
thanks for guidance, I would try it and if needed shall be back to this thread.

thank you both.

Dipesh
Reply With Quote
  #7  
Old 27th August 2009, 14:11
dipeshmehta dipeshmehta is offline
Senior Member
 
Join Date: Nov 2008
Location: Rajkot, India
Posts: 173
Thanks: 5
Thanked 13 Times in 13 Posts
Send a message via Yahoo to dipeshmehta Send a message via Skype™ to dipeshmehta
 
Default

Thanks to both of you. I works exactly as I wished.

Dipesh
Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

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 On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
freebsd 7, samba 3, domain controller alexdimarco Suggest HOWTO 6 5th November 2010 16:54
simple shutdown script staticanime Programming/Scripts 6 28th February 2009 23:04
pop3 service alone is failed in "The Perfect Setup - Debian Sarge (3.1)" nandhu HOWTO-Related Questions 60 5th August 2008 15:15
Autoresponder installation problem cgi script won't run MikeM Installation/Configuration 8 14th September 2007 17:52
Script to run at startup - where to put ? contactme HOWTO-Related Questions 2 11th January 2007 20:48


All times are GMT +2. The time now is 13:40.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.