Results 1 to 3 of 3

Thread: Script helped needed to kill one app then launch another

  1. #1
    Join Date
    Mar 2007
    Beans
    33

    Script helped needed to kill one app then launch another

    Hi everybody, I was needing help with making a simple script that will let me basically toggle between two apps, the apps are Boxee and XBMC. I wanna have it kill XMBC and launch Boxee and vise versa. I could make a script that'll kill one and launch the other, but I wanna basically make it a toggle the I could execute via LIRC using my remote. Any help would be appreciated.

  2. #2
    Join Date
    Jan 2007
    Location
    Houston, TX
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Script helped needed to kill one app then launch another

    Something like this might get you there. Debugging needed:

    Code:
    #!/bin/bash
    
    PROGRAM1=”/usr/bin/boxee”
    PROGRAM2="/usr/bin/xbmc"
    
    APPCHK=$(ps aux | grep -c $PROGRAM1)
    
    
    if [ $APPCHK = '0' ];
    
    then
    
    Echo "Nothing running, starting $PROGRAM1"
    /usr/bin/boxee  &
    
    fi
    
    else
    
    if [ $APPCHK = '$PROGRAM1' ];
    
    then
    
    killall $PROGRAM1
    
    Echo "Killing $PROGRAM1 and starting $PROGRAM2"
    
    /usr/bin/xbmc &
    
    fi
    
    else
    
    if [ $APPCHK = '$PROGRAM2' ];
    
    then
    
    killall $PROGRAM2
    
    Echo "Killing $PROGRAM2 and starting $PROGRAM1"
    
    /usr/bin/boxee  &
    
    fi
    
    exit
    Last edited by toupeiro; September 11th, 2011 at 07:37 AM.
    "Its easy to come up with new ideas, the hard part is letting go of what worked for you two years ago, but will soon be out of date." -Roger von Oech

  3. #3
    Join Date
    Mar 2007
    Beans
    33

    Re: Script helped needed to kill one app then launch another

    Thank you very much, that's much better then what I wrote, basically I have two scripts to kill one then launch the other.

Tags for this Thread

Bookmarks

Posting Permissions

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