58 lines
1.3 KiB
Python
58 lines
1.3 KiB
Python
#!/usr/bin/env python
|
|
import time
|
|
import datetime
|
|
from datetime import timedelta
|
|
import commands
|
|
import os
|
|
|
|
#deluged, samba, mumble-server & nginx UP
|
|
def status(program):
|
|
if program == 'nginx':
|
|
path = '/var/run/nginx.pid'
|
|
if program == 'samba':
|
|
path = '/var/run/samba/smbd.pid'
|
|
if program == 'mumble':
|
|
path = '/var/run/mumble-server/mumble-server.pid'
|
|
if program == 'deluge':
|
|
path='/home/pi/.config/deluge/deluged.pid'
|
|
if os.path.isfile(path):
|
|
return True
|
|
else:
|
|
return False
|
|
def uptime():
|
|
with open('/proc/uptime', 'r') as f:
|
|
uptime_seconds = float(f.readline().split()[0])
|
|
uptime_string = str(timedelta(seconds = uptime_seconds))
|
|
|
|
return uptime_string
|
|
|
|
|
|
while True:
|
|
nginx = status('nginx')
|
|
mumble = status('mumble')
|
|
samba = status('samba')
|
|
deluge = status('deluge')
|
|
print '\n\n\n'
|
|
if nginx == True:
|
|
print '\tnginx on'
|
|
else:
|
|
print '\t nginx dead'
|
|
if mumble == True:
|
|
print '\tMumble on'
|
|
else:
|
|
print '\tMumble dead'
|
|
if samba == True:
|
|
print '\tSamba on'
|
|
else:
|
|
print '\tSamba dead'
|
|
if deluge == True:
|
|
print '\tDeluge on'
|
|
else:
|
|
print '\tDeluge dead'
|
|
print '\t-------------'
|
|
print '\t' + time.strftime('%d/%m/%Y %I:%M')
|
|
print '\t' + uptime()
|
|
uptime()
|
|
time.sleep(1)
|
|
os.system('clear')
|