Changeset 5537


Ignore:
Timestamp:
Jul 17, 2017, 1:34:08 PM (23 months ago)
Author:
hectorgh
Message:

trying to support thin clients as well

Location:
lliurex-shutdowner/trunk/fuentes/lliurex-shutdowner-common.install/usr/sbin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • lliurex-shutdowner/trunk/fuentes/lliurex-shutdowner-common.install/usr/sbin/shutdown-lliurex

    r5444 r5537  
    66
    77wait_time=1
    8 p=subprocess.Popen(["who | grep tty"],shell=True,stdout=subprocess.PIPE).communicate()[0]
     8p=subprocess.Popen(["who"],shell=True,stdout=subprocess.PIPE).communicate()[0]
    99ret=os.system("lliurex-version -t server")
     10is_thin=os.system("lliurex-version -x thin")
    1011
    1112if ret==0:
    12         wait_time=2
     13        if is_thin!=0:
     14                wait_time=2
    1315
    1416t=time.localtime()
    1517shutdown_date="%s:%s"%(t.tm_hour,t.tm_min+wait_time)
    1618
     19displays=set()
    1720
    1821for item in p.strip("\n").split("\n"):
    1922        x=item.split(" ")
    2023        user=x[0]
    21         if "(" not in x[-1] and ")" not in x[-1]:
     24        if "(" not in x[-1] or ")" not in x[-1] or ":" not in x[-1] or "." not in x[-1]:
    2225                continue
    2326        display=x[-1].lstrip("(").rstrip(")")
     27        if display not in displays:
     28                displays.add(display)
     29        else:
     30                continue
    2431        cmd="su -c 'DISPLAY=%s /usr/sbin/shutdown-lliurex-dialog %s' %s &"%(display,wait_time,user)
    25         #cmd="su -c 'zenity --info --text=\"System will shutdown at %s, please save your files.\" --display %s\' %s &"%(shutdown_date,display,user)
    2632        os.system(cmd)
    2733
    28 os.system("/sbin/shutdown -h +%s"%wait_time)
    2934
     35if is_thin!=0:
     36        os.system("/sbin/shutdown -h +%s"%wait_time)
     37else:
     38        time.sleep(60*wait_time)
     39        os.system("n4d-client -r -m shutdown -c ShutdownerClient")
    3040
    31 
  • lliurex-shutdowner/trunk/fuentes/lliurex-shutdowner-common.install/usr/sbin/shutdown-lliurex-dialog

    r5455 r5537  
    5555                ret=os.system("lliurex-version -t server 2>/dev/null")
    5656               
    57                 if ret!=0:
     57                is_thin=os.system("lliurex-version -x thin")
     58               
     59                if ret!=0 or is_thin==0:
    5860                        self.buttons_box.hide()
    5961                       
Note: See TracChangeset for help on using the changeset viewer.