simple shutdown script

Discussion in 'Programming/Scripts' started by staticanime, Dec 26, 2008.

  1. staticanime

    staticanime New Member

    Hey, I'm trying to make a script to be run by VirtualMin to stop my xbtt torrent tracker when the server is shutdown/restarted.

    I have a script called and in it I have
    cd /home/xbtt/Tracker/
    kill 'cat'
    now, I can't get the kill 'cat' to work. All I wanted it to do is read the PID number in the (which works with cat) and pass it onto kill :(

    PS. Server is Ubuntu 8.04
  2. falko

    falko Super Moderator ISPConfig Developer

    kill ´cat´
    instead of
    kill 'cat'
  3. staticanime

    staticanime New Member

    Yep, that worked like a charm, thanks Falko
  4. stutch

    stutch New Member

    How would I set this up if I wanted it to execute before the server is brought down automatically?
  5. sjau

    sjau Local Meanie Moderator

    why not write a real initrd script and then add it to the default runlevels?
  6. ebal

    ebal New Member

    kill sends TERM signal so there is a possibility not to kill your process.

    I use pkill command without knowing the PID of the process and after a sleep i use pkill -9 just to be sure.

    something like this:

    pkill apache
    sleep 3
    pkill -9 apache
  7. sjau

    sjau Local Meanie Moderator

Share This Page