~ubuntu-branches/ubuntu/saucy/cairo-dock-plug-ins/saucy

« back to all changes in this revision

Viewing changes to logout/data/logout.sh

Tags: upstream-3.0.0.0beta1
ImportĀ upstreamĀ versionĀ 3.0.0.0beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/bash
2
 
 
3
 
# look for GDM/KDM/LDM/XDM
 
2
#
 
3
# Copyright : (C) see the 'copyright' file.
 
4
# E-mail    : see the 'copyright' file.
 
5
#
 
6
#
 
7
# This program is free software; you can redistribute it and/or
 
8
# modify it under the terms of the GNU General Public License
 
9
# as published by the Free Software Foundation; either version 3
 
10
# of the License, or (at your option) any later version.
 
11
#
 
12
# This program is distributed in the hope that it will be useful,
 
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
15
# GNU General Public License for more details.
 
16
# http://www.gnu.org/licenses/licenses.html#GPL
 
17
#
 
18
#
 
19
# look for GDM/KDM/LDM/XDM/lightdm
4
20
# if one of them is used, then it has launched either the session-manager, or the stand-alone script, both blocking.
5
21
# so just take this one, and kill it so that we return to GDM.
6
 
gdm_proc=`pgrep "gdm|kdm|ldm|xdm" | tail -1`
 
22
 
 
23
gdm_proc=`pgrep "gdm|kdm|ldm|xdm|lightdm" | tail -1`
7
24
if test -n "$gdm_proc"; then
8
25
        last_process=`ps -ef | grep $gdm_proc | grep -v grep | tail -1 | tr -s " " | cut -d " " -f 2`
9
26
        if test -n "$last_process"; then
13
30
fi
14
31
 
15
32
# if the display manager couldn't be found, look for an endless sleep (likely to be the last process of the session), and kill it.
16
 
sleep_proc=`ps -ef | grep sleep | head -1`
 
33
sleep_proc=`ps -ef | grep sleep | grep -v grep | head -1`
17
34
if test -n "$sleep_proc"; then
18
35
        sleep_time=`echo $sleep_proc | sed "s/.*sleep//g"`
19
36
        if test $sleep_time -gt 3600; then