Changeset 5426


Ignore:
Timestamp:
Jun 30, 2017, 12:49:04 PM (18 months ago)
Author:
hectorgh
Message:

changing msg

File:
1 edited

Legend:

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

    r5407 r5426  
    33import subprocess
    44import os
     5import time
    56
     7wait_time=1
    68p=subprocess.Popen(["who | grep tty"],shell=True,stdout=subprocess.PIPE).communicate()[0]
     9ret=os.system("lliurex-version -t server")
    710
    8 ret=os.system("lliurex-version -t server")
    9 wait_time=1
    1011if ret==0:
    11         wait_time=3
     12        wait_time=2
     13
     14t=time.localtime()
     15shutdown_date="%s:%s"%(t.tm_hour,t.tm_min+wait_time)
     16
    1217
    1318for item in p.strip("\n").split("\n"):
    1419        x=item.split(" ")
    15         print x
    1620        user=x[0]
    17         print user
    1821        if "(" not in x[-1] and ")" not in x[-1]:
    1922                continue
    2023        display=x[-1].lstrip("(").rstrip(")")
    21         cmd="su -c 'zenity --info --text=\"System will shutdown in %s minutes, please save your files.\" --display %s\' %s &"%(wait_time,display,user)
    22         print(cmd)
     24        cmd="su -c 'zenity --info --text=\"System will shutdown at %s, please save your files.\" --display %s\' %s &"%(shutdown_date,display,user)
    2325        os.system(cmd)
    2426
Note: See TracChangeset for help on using the changeset viewer.