Find the answer to your Linux question:
Results 1 to 6 of 6
I would like to run a command or script on every shutdown or startup, or maybe both, could someone point me in the right direction please?...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    46

    Start up/shutdown

    I would like to run a command or script on every shutdown or startup, or maybe both, could someone point me in the right direction please?

  2. #2
    Linux Newbie
    Join Date
    Feb 2009
    Location
    Third ring of Pergatory
    Posts
    199
    rc.local is the customary place to put start-up scripts.
    Shutdown scripts work better if you call the shudown via /sbin/shutdown inside another script rather than trying to rewrite shutdown itself. I.E don't try to edit shutdown, write a script that contains the commands you want run and place /bin/shutdown at the end of it. (the very end) then call shutdown through the script.

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    46
    Where is rc.local? If I create it, where do I put it?

  4. #4
    Linux Newbie
    Join Date
    Mar 2009
    Posts
    228
    It's located in /etc.

  5. #5
    Trusted Penguin elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    2,298
    How you do this depends on the distro - and the runlevel you want it to run at.

    What distro are you using?
    If we hit that bullseye, the rest of the dominoes will fall like a house of cards. Checkmate! (Zapp Brannigan)


    My new blog. It's probably not as good as I think it is.

  6. #6
    Just Joined!
    Join Date
    Nov 2007
    Posts
    46
    Sorry folks, I usually post in SUSE forums got out of the habit:
    I use openSUSE 11.1 (kde 3.5)

Posting Permissions

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