how to to run script at shutdown event

Discussion in 'Desktop Operation' started by dipeshmehta, Aug 25, 2009.

  1. dipeshmehta

    dipeshmehta Member

    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
     
  2. topdog

    topdog Active Member

  3. id10t

    id10t Member

    Put your scripts in /etc/rc0.d (shutdown) and /etc/rc6.d (reboot)
     
  4. topdog

    topdog Active Member

    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
     
  5. id10t

    id10t Member

    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.



     
  6. dipeshmehta

    dipeshmehta Member

    thanks for guidance, I would try it and if needed shall be back to this thread.

    thank you both.

    Dipesh
     
  7. dipeshmehta

    dipeshmehta Member

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

    Dipesh
     

Share This Page