Upload files to ''
This commit is contained in:
parent
950f048f2b
commit
70f51be208
|
|
@ -0,0 +1,153 @@
|
|||
import time
|
||||
import datetime
|
||||
import spidev
|
||||
import requests
|
||||
import RPi.GPIO as GPIO
|
||||
import commands
|
||||
import glyph
|
||||
from lcdlib import *
|
||||
#functions
|
||||
def position(x, y):
|
||||
# maths the line number + other binary
|
||||
GPIO.output(DC, False)
|
||||
x = (x+128)
|
||||
y = (y+64)
|
||||
spi.writebytes([x, y])
|
||||
GPIO.output(DC, True)
|
||||
# display commands
|
||||
def writeword(word):
|
||||
GPIO.output(DC, True)
|
||||
for x in word:
|
||||
if x == " ":
|
||||
spi.writebytes(glyph.SPACE)
|
||||
else:
|
||||
spi.writebytes(getattr(glyph, x))
|
||||
def writedelay(word):
|
||||
for x in word:
|
||||
if x == " ":
|
||||
spi.writebytes(glyph.SPACE)
|
||||
else:
|
||||
spi.writebytes(getattr(glyph, x))
|
||||
time.sleep(0.3)
|
||||
def clearscreen():
|
||||
GPIO.output(DC, True)
|
||||
x = 0
|
||||
while x < (48*84):
|
||||
spi.writebytes([0x00])
|
||||
x+=1
|
||||
def splash():
|
||||
position(0,0)
|
||||
spi.writebytes(glyph.SCREEN)
|
||||
time.sleep(1.0)
|
||||
#setup hw
|
||||
spi = spidev.SpiDev()
|
||||
spi.open(0,0)
|
||||
spi.max_speed_hz=400000
|
||||
#gpio pin definitions
|
||||
DC = 23
|
||||
RST = 24
|
||||
DIN = 19
|
||||
|
||||
SPI_PORT = 0
|
||||
SPI_DEVICE = 0
|
||||
|
||||
#gpio setup
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(RST, GPIO.OUT)
|
||||
GPIO.setup(DC, GPIO.OUT)
|
||||
|
||||
#LEDs
|
||||
led1 = 12
|
||||
led2 = 20
|
||||
led3 = 16
|
||||
led4 = 21
|
||||
led5 = 26
|
||||
button1 = 5 #green
|
||||
button2 = 6 #red
|
||||
button3 = 13 #up
|
||||
button4 = 19 #down
|
||||
screen = 18
|
||||
GPIO.setup(led1, GPIO.OUT)
|
||||
GPIO.setup(led2, GPIO.OUT)
|
||||
GPIO.setup(led3, GPIO.OUT)
|
||||
GPIO.setup(led4, GPIO.OUT)
|
||||
GPIO.setup(led5, GPIO.OUT)
|
||||
GPIO.setup(button1, GPIO.IN)
|
||||
GPIO.setup(button2, GPIO.IN)
|
||||
GPIO.setup(button3, GPIO.IN)
|
||||
GPIO.setup(button4, GPIO.IN)
|
||||
GPIO.setup(screen, GPIO.OUT)
|
||||
GPIO.output(screen, False)
|
||||
|
||||
#pulse reset
|
||||
GPIO.output(RST, False)
|
||||
time.sleep(0.4)
|
||||
GPIO.output(RST, True)
|
||||
|
||||
#DC low for commands
|
||||
GPIO.output(DC, False)
|
||||
spi.writebytes([0x21, 0xB8, 0x04, 0x14, 0x20, 0x09, 0x0C])
|
||||
|
||||
#transmit data
|
||||
GPIO.output(DC, True)
|
||||
splash()
|
||||
clearscreen()
|
||||
while True:
|
||||
process_list = commands.getoutput('ps -A')
|
||||
if 'nginx' in process_list:
|
||||
GPIO.output(led1, True)
|
||||
else:
|
||||
GPIO.output(led1, False)
|
||||
if 'smbd' in process_list:
|
||||
GPIO.output(led2, True)
|
||||
else:
|
||||
GPIO.output(led2, False)
|
||||
if 'murmurd' in process_list:
|
||||
GPIO.output(led3, True)
|
||||
else:
|
||||
GPIO.output(led3, False)
|
||||
if 'deluged' in process_list:
|
||||
GPIO.output(led4, True)
|
||||
else:
|
||||
GPIO.output(led4, False)
|
||||
position(5,0)
|
||||
writeword("ironserver")
|
||||
position(10,1)
|
||||
writeword("nginx")
|
||||
position(10,2)
|
||||
writeword("samba")
|
||||
position(10,3)
|
||||
writeword("murmur")
|
||||
position(10,4)
|
||||
writeword("deluge")
|
||||
position(10,5)
|
||||
writeword("ipstv")
|
||||
# check http
|
||||
position(60,1)
|
||||
if 'nginx' in process_list:
|
||||
writeword("on")
|
||||
spi.writebytes(glyph.SPACE)
|
||||
else:
|
||||
writeword("off")
|
||||
# check nas
|
||||
position(60,2)
|
||||
if 'smbd' in process_list:
|
||||
writeword("on")
|
||||
spi.writebytes(glyph.SPACE)
|
||||
else:
|
||||
writeword("off")
|
||||
#check VOIP
|
||||
position(60,3)
|
||||
if 'murmurd' in process_list:
|
||||
writeword("on")
|
||||
spi.writebytes(glyph.SPACE)
|
||||
else:
|
||||
writeword("off")
|
||||
#check torrents
|
||||
position(60,4)
|
||||
if 'deluged' in process_list:
|
||||
writeword("on")
|
||||
spi.writebytes(glyph.SPACE)
|
||||
else:
|
||||
writeword("off")
|
||||
spi.close()
|
||||
|
|
@ -0,0 +1,129 @@
|
|||
import time
|
||||
import spidev
|
||||
import RPi.GPIO as GPIO
|
||||
import glyph
|
||||
|
||||
spi = spidev.SpiDev()
|
||||
spi.open(0,0)
|
||||
spi.max_speed_hz=5000000
|
||||
#gpio pin definitions
|
||||
DC = 23
|
||||
RST = 24
|
||||
DIN = 19
|
||||
|
||||
SPI_PORT = 0
|
||||
SPI_DEVICE = 0
|
||||
|
||||
#gpio setup
|
||||
GPIO.setmode(GPIO.BCM)
|
||||
GPIO.setup(RST, GPIO.OUT)
|
||||
GPIO.setup(DC, GPIO.OUT)
|
||||
|
||||
#pulse reset
|
||||
GPIO.output(RST, False)
|
||||
time.sleep(0.1)
|
||||
GPIO.output(RST, True)
|
||||
|
||||
#LED setup
|
||||
GPIO.setup(18, GPIO.OUT)
|
||||
GPIO.output(18, False)
|
||||
|
||||
#command test
|
||||
#DC low for commands
|
||||
GPIO.output(DC, False)
|
||||
#resp = spi.xfer2([0x21, 0xB8, 0x04, 0x14, 0x20,0x09])
|
||||
spi.writebytes([0x21])
|
||||
spi.writebytes([0xB8])
|
||||
spi.writebytes([0x04])
|
||||
spi.writebytes([0x14])
|
||||
spi.writebytes([0x20])
|
||||
spi.writebytes([0x09])
|
||||
spi.writebytes([0x0C])
|
||||
#test transmit data
|
||||
GPIO.output(DC, True)
|
||||
spi.writebytes(glyph.I)
|
||||
spi.writebytes(glyph.R)
|
||||
spi.writebytes(glyph.O)
|
||||
spi.writebytes(glyph.N)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.S)
|
||||
spi.writebytes(glyph.E)
|
||||
spi.writebytes(glyph.R)
|
||||
spi.writebytes(glyph.V)
|
||||
spi.writebytes(glyph.E)
|
||||
spi.writebytes(glyph.R)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes([0x00, 0x00, 0x00, 0x00])
|
||||
spi.writebytes(glyph.D)
|
||||
spi.writebytes(glyph.E)
|
||||
spi.writebytes(glyph.L)
|
||||
spi.writebytes(glyph.U)
|
||||
spi.writebytes(glyph.G)
|
||||
spi.writebytes(glyph.E)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes([0x00,0x00,0x00,0x00])
|
||||
spi.writebytes(glyph.M)
|
||||
spi.writebytes(glyph.U)
|
||||
spi.writebytes(glyph.R)
|
||||
spi.writebytes(glyph.M)
|
||||
spi.writebytes(glyph.U)
|
||||
spi.writebytes(glyph.R)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes([0x00,0x00,0x00,0x00])
|
||||
spi.writebytes(glyph.S)
|
||||
spi.writebytes(glyph.A)
|
||||
spi.writebytes(glyph.M)
|
||||
spi.writebytes(glyph.B)
|
||||
spi.writebytes(glyph.A)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes([0x00,0x00,0x00,0x00])
|
||||
spi.writebytes(glyph.N)
|
||||
spi.writebytes(glyph.G)
|
||||
spi.writebytes(glyph.I)
|
||||
spi.writebytes(glyph.N)
|
||||
spi.writebytes(glyph.X)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes(glyph.SPACE)
|
||||
spi.writebytes([0x00,0x00,0x00,0x00])
|
||||
spi.close()
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
#alphanumerics
|
||||
A = [0xfc, 0x12, 0x12, 0x12, 0xfc]
|
||||
B = [0xfe, 0x92, 0x92, 0x92, 0x6c]
|
||||
C = [0x7c, 0x82, 0x82, 0x82, 0x82]
|
||||
D = [0xfe, 0x82, 0x82, 0x82, 0x7c]
|
||||
E = [0xfe, 0x92, 0x92, 0x92, 0x92]
|
||||
F = [0xfe, 0x12, 0x12, 0x12, 0x12]
|
||||
G = [0xfe, 0x82, 0x82, 0x92, 0xf2]
|
||||
H = [0xfe, 0x10, 0x10, 0xfe, 0xFE]
|
||||
I = [0x00, 0x41, 0x7f, 0x7f, 0x41]
|
||||
J = [0x42, 0x82, 0x7e, 0x02, 0x02]
|
||||
K = [0xfe, 0x10, 0x28, 0xc6, 0xC6]
|
||||
L = [0xfe, 0x80, 0x80, 0x80, 0x80]
|
||||
M = [0xfe, 0x04, 0x08, 0x04, 0xfe]
|
||||
N = [0xfe, 0x0c, 0x70, 0xfe, 0x00]
|
||||
O = [0x7c, 0x82, 0x82, 0x7c, 0x00]
|
||||
P = [0xfe, 0x12, 0x12, 0x12, 0x0c]
|
||||
Q = [0x7c, 0x82, 0xa2, 0x42, 0xbc]
|
||||
R = [0xfe, 0x12, 0x12, 0xec, 0x00]
|
||||
S = [0x8c, 0x92, 0x92, 0x62, 0x00]
|
||||
T = [0x02, 0x02, 0xfe, 0x02, 0x02]
|
||||
U = [0x7e, 0x80, 0x80, 0x80, 0x7e]
|
||||
V = [0x7e, 0x80, 0x40, 0x3e, 0x00]
|
||||
W = [0x7e, 0x80, 0x40, 0x80, 0x7e]
|
||||
X = [0xc6, 0x28, 0x10, 0x28, 0xc6]
|
||||
Y = [0x06, 0x08, 0xf0, 0x08, 0x06]
|
||||
Z = [0x86, 0x8a, 0x92, 0xa2, 0xc2]
|
||||
#
|
||||
a = [0x00, 0x20, 0x74, 0x54, 0x7c, 0x78]
|
||||
b = [0x00, 0x7f, 0x7f, 0x44, 0x7c, 0x38]
|
||||
c = [0x00, 0x38, 0x7c, 0x44, 0x44]
|
||||
d = [0x00, 0x38, 0x7c, 0x44, 0x7f, 0x7f]
|
||||
e = [0x00, 0x38, 0x7c, 0x54, 0x5c, 0x58]
|
||||
f = [0x00, 0xf0, 0x48, 0x48, 0x10]
|
||||
g = [0x00, 0x18, 0xbc, 0xa4, 0xfc, 0x7c]
|
||||
h = [0x00, 0x7f, 0x7f, 0x04, 0x7c, 0x78]
|
||||
i = [0x00, 0x7d, 0x7d]
|
||||
j = [0x40, 0x80, 0x68, 0x00, 0x00]
|
||||
k = [0x00, 0xf8, 0x20, 0xd8, 0x00]
|
||||
l = [0x00, 0x7f, 0x7f]
|
||||
m = [0x00, 0x7c, 0x04, 0x18, 0x04, 0x78]
|
||||
n = [0x00, 0x7c, 0x7c, 0x04, 0x7c, 0x78]
|
||||
o = [0x00, 0x38, 0x7c, 0x44, 0x7c, 0x38]
|
||||
p = [0x00, 0xfc, 0xfc, 0x24, 0x3c, 0x18]
|
||||
q = [0x00, 0x10, 0x28, 0xf0, 0x80]
|
||||
r = [0x00, 0x00, 0x7c, 0x7c, 0x08, 0x0c]
|
||||
s = [0x00, 0x58, 0x5c, 0x74, 0x34]
|
||||
t = [0x00, 0x3f, 0x7f, 0x44]
|
||||
u = [0x00, 0x3c, 0x7c, 0x40, 0x7c, 0x7c]
|
||||
v = [0x00, 0x0c, 0x3c, 0x70, 0x3c, 0x0c]
|
||||
x = [0x00, 0x44, 0x6c, 0x38, 0x6c, 0x44]
|
||||
y = [0x00, 0x1c, 0xbc, 0xa0, 0xfc, 0x7c]
|
||||
z = [0x88, 0xc8, 0xa8, 0x98, 0x88]
|
||||
#punctuation
|
||||
COMMA = [0x00, 0xc0, 0x60]
|
||||
SPACE = [0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
COLON = [0x00, 0x6c, 0x6c, 0x00, 0x00]
|
||||
APOSTROPHE = [0x00, 0x03]
|
||||
FULLSTOP = [ 0x00, 0x60, 0x60 ]
|
||||
|
||||
#NUMBERS
|
||||
ONE = [0x00, 0xFF, 0xFF, 0x00, 0x00]
|
||||
TWO = [0xc6, 0xa1, 0x91, 0x89, 0x86]
|
||||
THREE = [0x42, 0x81, 0x89, 0x89, 0x76]
|
||||
FOUR = [0x1f, 0x10, 0xfc, 0x10, 0x10]
|
||||
FIVE = [0x87, 0x89, 0x89, 0x89, 0x71]
|
||||
SIX = [0x7c, 0x8a, 0x89, 0x89, 0x70]
|
||||
SEVEN = [0x01, 0x11, 0x11, 0xff, 0x10]
|
||||
EIGHT = [0x76, 0x89, 0x89, 0x89, 0x76]
|
||||
NINE = [0x0e, 0x91, 0x91, 0x91, 0x6e]
|
||||
ZERO = [0x7e, 0xb1, 0x99, 0x8d, 0x7e]
|
||||
# Symbols / icons
|
||||
TORRENT = [0x18, 0xf4, 0x82, 0xff, 0x00, 0xff, 0x41, 0x2f, 0x10]
|
||||
SSH = [0xfe, 0x82, 0x8a, 0x92, 0xa2, 0x82, 0x82, 0x82, 0xfe]
|
||||
SHARE = [0x1e, 0x12, 0xb2, 0x1e, 0x80, 0x00, 0x84, 0xce, 0xce]
|
||||
WEB = [0xf0, 0x9e, 0x90, 0x9e, 0x90, 0x9e, 0x90, 0x9e, 0xf0]
|
||||
# art
|
||||
SCREEN = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x30, 0x30, 0x30, 0x70, 0xE0, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xE0, 0x60, 0x60, 0x70, 0x30, 0x38, 0xBC, 0xAC, 0xAC, 0xBC, 0x38, 0x30, 0x70, 0x60, 0x60, 0xE0, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0xF0, 0x38, 0x1C, 0x0C, 0x1C, 0x38, 0x70, 0xE0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xF0, 0xFC, 0x1E, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00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, 0x90, 0x90, 0x91, 0x8A, 0x8C, 0x89, 0x8B, 0xD3, 0xE6, 0x64, 0x64, 0x64, 0x37, 0x1C, 0x0F, 0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00, 0xFF, 0xFF, 0x03, 0x03, 0x07, 0x0E, 0x1C, 0x3C, 0x7F, 0xFF, 0xC0, 0x80, 0x3F, 0xFF, 0xE0, 0x00, 0x3E, 0xFE, 0xE0, 0x00, 0x03, 0x7F, 0xFF, 0x00, 0x00, 0xFF, 0x03, 0x01, 0x00, 0x70, 0xF8, 0xDF, 0xCF, 0xE0, 0x70, 0x7F, 0x3F, 0x0E, 0x07, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1F, 0x3F, 0x30, 0x70, 0x67, 0x67, 0xEE, 0xCC, 0xDC, 0xB8, 0x30, 0x70, 0x60, 0x60, 0xE0, 0xC0, 0xC0, 0x80, 0x00, 0x00, 0x80, 0xC0, 0xC0, 0xE0, 0x60, 0x60, 0x70, 0x30, 0xB8, 0xDC, 0xCC, 0xEE, 0x67, 0x67, 0x70, 0x30, 0x3F, 0x1F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x1F, 0x3F, 0x38, 0x70, 0x67, 0xEF, 0xFC, 0xB8, 0x00, 0x00, 0xF3, 0xFC, 0x07, 0x0E, 0x0C, 0x0C, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x07, 0x06, 0x06, 0x0E, 0x0C, 0x1D, 0x3B, 0x33, 0x33, 0x3B, 0x1D, 0x0C, 0x0E, 0x06, 0x06, 0x07, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x07, 0x06, 0x06, 0x01, 0x0]
|
||||
SONA = [0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x60, 0x70, 0x30, 0x38, 0x1C, 0x0C, 0x0C, 0x0C, 0x0E, 0x06, 0x06, 0x06, 0x07, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x87, 0xC6, 0xCE, 0xFC, 0xF8, 0xE0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xC0, 0xE0, 0xF8, 0x7C, 0xEE, 0xE6, 0x87, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x07, 0x06, 0x06, 0x06, 0x0E, 0x0C, 0x0C, 0x0C, 0x1C, 0x38, 0x30, 0x70, 0xF0, 0xC0, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xC0, 0xFC, 0xFE, 0x3E, 0x37, 0x3B, 0x1D, 0x0E, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xC0, 0xE0, 0x70, 0x30, 0xFF, 0xFF, 0x0D, 0x06, 0x07, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x07, 0x07, 0x06, 0x07, 0x0F, 0x1F, 0x38, 0x70, 0xE0, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x0F, 0xFE, 0xF8, 0x80, 0x00, 0x00, 0x00, 0x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, 0xF8, 0xF0, 0xE0, 0xC0, 0x01, 0x0F, 0x0F, 0x3F, 0x7F, 0x7E, 0x7F, 0xFF, 0xCC, 0x8E, 0x0F, 0x07, 0x03, 0x48, 0x48, 0x40, 0x40, 0x40, 0x47, 0x6F, 0x0C, 0x0E, 0x0F, 0x0F, 0x07, 0xC3, 0xE1, 0x70, 0x78, 0x6C, 0x44, 0x47, 0x3F, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x80, 0xC0, 0xE0, 0x70, 0x3F, 0x1F, 0x03, 0x81, 0xC0, 0xE0, 0x70, 0xFF, 0xFF, 0x83, 0x81, 0xC0, 0xF8, 0x7C, 0x0F, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0F, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0x03, 0x01, 0x03, 0x03, 0x03, 0x07, 0x06, 0x06, 0x06, 0x0E, 0x0C, 0x0D, 0x0F, 0x0F, 0x0E, 0x0E, 0x0E, 0x0E, 0x06, 0x06, 0x0E, 0x0E, 0x16, 0x0E, 0x1E, 0x1E, 0x16, 0x07, 0x07, 0x0F, 0x0C, 0x0C, 0x0C, 0x0C, 0x0E, 0x06, 0x06, 0x06, 0x06, 0x07, 0x0F, 0x0F, 0x0F, 0x0D, 0x0C, 0x0C, 0x0E, 0x06, 0x06, 0x07, 0x03, 0x00, 0x00, 0x03, 0x03, 0x03, 0x03, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]
|
||||
|
|
@ -0,0 +1,57 @@
|
|||
#!/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')
|
||||
Loading…
Reference in New Issue