Results 1 to 2 of 2

Thread: Add script to the shutdown process

  1. #1
    Join Date
    Jun 2007
    Ubuntu 8.04 Hardy Heron

    Arrow Add script to the shutdown process


    I want to make a script or add a part to an existing script that checks if there are any screen sessions running and if so send a quit message to them. But where do I find the shutdown scripts or how do I make a script run on shutdown? It's something about run levels right?

    All answers are appreciated!
    Thanks /Ballena - Search The Web
    "There are people who don't like capitalism, and people who don't like PCs. But there's no one who likes the PC who doesn't like Microsoft." - Bill Gates

  2. #2
    Join Date
    May 2008
    Eugene, OR, USA

    Re: Add script to the shutdown process

    Create your shell script in /etc/init.d-- let's suppose for purposes of this example you're going to call the script "screenshutdown". Then you have to make links to the script in the various /etc/rc?.d directories:

    for d in /etc/rc?.d; do
        ln -s /etc/init.d/screenshutdown $d/S99screenshutdown
    The link to the script in the approrpriate /etc/rc?.d directory is what causes it to be executed when the system shuts down.

    You might find this thread helpful for explaining the role of these various directories in the system boot process:
    Hal Pomeranz, Deer Run Associates
    [[ Various Linux/Unix related documents ]]
    [[ Command-Line Kung Fu blog ]]


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts