Results 1 to 3 of 3

Thread: Run command when logout is initiated

  1. #1
    Join Date
    Jun 2009
    Location
    0:0:0:0:0:0:0:1
    Beans
    4,316
    Distro
    Xubuntu 13.04 Raring Ringtail

    Run command when logout is initiated

    i had a script running when lightdm's session exits, but as of raring the script runs too late to get the job done
    i need it to run "gmusicbrowser -cmd Quit" as soon as i click shutdown/logout

    this is what i was using, it ran as root from lightdm's session cleanup script
    Code:
    pid="`pgrep -f gmusicbrowser | head -1`"
    if [ "0$pid" -gt "0" ]; then
        user=$(ps aux | awk '{print $1" "$2}' | grep $pid | awk '{print $1}')
        sudo -u $user gmusicbrowser -cmd Quit
    fi
    Last edited by pqwoerituytrueiwoq; March 24th, 2013 at 06:45 PM.
    Laptop: ASUS A54C-NB91 (Storage: WD3200BEKT + MKNSSDCR60GB-DX); Desktop: Custom Build - Images included; rPi Server
    Putting your Networked Printer's scanner software to shame PHP Scanner Server
    I frequently edit my post when I have the last post

  2. #2
    dino99's Avatar
    dino99 is offline Ubuntu addict and loving it
    Join Date
    Jun 2006
    Location
    Nux Jam
    Beans
    Hidden!
    Distro
    Ubuntu Development Release

    Re: Run command when logout is initiated

    i does not know how to do that, but you need to set a priority to your script, or teach it about the logout process (kind of while !=logout)

  3. #3
    Join Date
    Jun 2009
    Location
    0:0:0:0:0:0:0:1
    Beans
    4,316
    Distro
    Xubuntu 13.04 Raring Ringtail

    Re: Run command when logout is initiated


    it is closing properly, i thought is was not cause it opened with a error at login, but really it was starting before pulse-audio which made it give a error
    i edited my startup entry to this
    Code:
    sh -c 'volume delay;gmusicbrowser -play'
    volume script: http://pastebin.com/cxahpsh5
    note lines 5 - 7
    the script can tell you your audio device my using the dump option, it needs to have that output before it becomes detectable
    Last edited by pqwoerituytrueiwoq; March 24th, 2013 at 07:53 PM.
    Laptop: ASUS A54C-NB91 (Storage: WD3200BEKT + MKNSSDCR60GB-DX); Desktop: Custom Build - Images included; rPi Server
    Putting your Networked Printer's scanner software to shame PHP Scanner Server
    I frequently edit my post when I have the last post

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
  •