Terminal MC9090 i MC9000 restet gorący wykonuje sie przez długie naciśnięsie klawisza power.
Jeśli długo nie jest wstawiany do stacji dokującej aby podładować baterię backupową, przy restarcie potrafi się zwiesić i trwać na ekranie startowym, wtedu ratuje zimny restart
1. Wyciągnąć baterię
2. Nacisnąć Power + spust lasera
3. Włożyc baterię
środa, 9 grudnia 2009
wtorek, 18 sierpnia 2009
Pythonowy skrypt wysyłający maile
Na ESXie nie ma klienta pocztowego ale jest python, wystarczy żeby wysłać maila z raportem, powstał na kolanie ale podstawowe zadania wykonuje:
---------------
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
import smtplib
import getopt
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import formatdate
from email import Encoders
"""Skrypt wysylajacy maile
skladnia pymail.py -s SERWER -f FROM -t TO -S Subject [-m message -a attachment]
FROM adres od
TO adres do
SUBJECT temat maila
SERVER nazwa serwera SMTP
MSG tresc wiadomosci
ATT plik zalacznika
"""
## startowe paramettry - ustawione na puste
FROM = ""
TO=""
SUBJECT=""
SERVER=""
MSG=""
ATT=""
def usage():
plik=os.path.basename(sys.argv[0])
print "Usage: "
print "%s -s SERWER -f FROM -t TO -S Subject [-m message -a attachment] " % plik
print "or"
print "%s --server SERWER --from FROM --to TO --Subject Subject [--message message --attach attachment] " % plik
exit()
# wczytaj parametry wywołania , uwaga sys.arg[0] = nazwa skryptu
cmdline_params = sys.argv[1:]
# dopisz do tablic zmiennych parametry i wartosci
try:
opts, args = getopt.gnu_getopt(cmdline_params,"f:hs:t:S:a:m:", "help","from","server","to","Subject","attach","message"])
except getopt.GetoptError, err:
print str(err)
sys.exit(2)
#sprawdz parametry i podstaw do zmiennych
for option, par in opts:
if option in ("-f","--from"):
FROM = par
elif option in ("-t","--to"):
TO = par
elif option in ("-s","--server"):
SERVER = par
elif option in ("-m","--message"):
MSG = par
elif option in ("-a","--attach"):
ATT = par
elif option in ("-S","--Subject"):
SUBJECT = par
elif option in ("-h","--help"):
usage()
else:
print "Unknown parameter"
assert False, "unhandled option"
usage()
sys.exit(2)
if len(FROM) == 0:
print "You have to set -f FROM"
exit()
if len(TO) == 0:
print "You have to set -t TO"
exit()
if len(SERVER) == 0:
print "You have to set -s ServerSMTP"
exit()
if len(SUBJECT) == 0:
print "You have to set -S Subject"
exit()
#SUBJECT = "Subject: " +sys.argv[1]
print "Connecting to server"
server = smtplib.SMTP("localhost")
msg = MIMEMultipart()
msg["From"] = FROM
msg["To"] = TO
msg["Date"] = formatdate(localtime=True)
msg["Subject"] = SUBJECT
if len(MSG)>0:
msg.attach( MIMEText(MSG) )
if len(ATT)>0:
part = MIMEBase("application", "octet-stream")
part.set_payload(open(ATT, "rb").read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename= %s' % os.path.basename(ATT))
msg.attach(part)
print 'Sending %s' % ATT
server.sendmail(FROM, TO, msg.as_string())
print 'Done'
server.close()
print 'All Done'
---------------
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os, sys
import smtplib
import getopt
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import formatdate
from email import Encoders
"""Skrypt wysylajacy maile
skladnia pymail.py -s SERWER -f FROM -t TO -S Subject [-m message -a attachment]
FROM adres od
TO adres do
SUBJECT temat maila
SERVER nazwa serwera SMTP
MSG tresc wiadomosci
ATT plik zalacznika
"""
## startowe paramettry - ustawione na puste
FROM = ""
TO=""
SUBJECT=""
SERVER=""
MSG=""
ATT=""
def usage():
plik=os.path.basename(sys.argv[0])
print "Usage: "
print "%s -s SERWER -f FROM -t TO -S Subject [-m message -a attachment] " % plik
print "or"
print "%s --server SERWER --from FROM --to TO --Subject Subject [--message message --attach attachment] " % plik
exit()
# wczytaj parametry wywołania , uwaga sys.arg[0] = nazwa skryptu
cmdline_params = sys.argv[1:]
# dopisz do tablic zmiennych parametry i wartosci
try:
opts, args = getopt.gnu_getopt(cmdline_params,"f:hs:t:S:a:m:", "help","from","server","to","Subject","attach","message"])
except getopt.GetoptError, err:
print str(err)
sys.exit(2)
#sprawdz parametry i podstaw do zmiennych
for option, par in opts:
if option in ("-f","--from"):
FROM = par
elif option in ("-t","--to"):
TO = par
elif option in ("-s","--server"):
SERVER = par
elif option in ("-m","--message"):
MSG = par
elif option in ("-a","--attach"):
ATT = par
elif option in ("-S","--Subject"):
SUBJECT = par
elif option in ("-h","--help"):
usage()
else:
print "Unknown parameter"
assert False, "unhandled option"
usage()
sys.exit(2)
if len(FROM) == 0:
print "You have to set -f FROM"
exit()
if len(TO) == 0:
print "You have to set -t TO"
exit()
if len(SERVER) == 0:
print "You have to set -s ServerSMTP"
exit()
if len(SUBJECT) == 0:
print "You have to set -S Subject"
exit()
#SUBJECT = "Subject: " +sys.argv[1]
print "Connecting to server"
server = smtplib.SMTP("localhost")
msg = MIMEMultipart()
msg["From"] = FROM
msg["To"] = TO
msg["Date"] = formatdate(localtime=True)
msg["Subject"] = SUBJECT
if len(MSG)>0:
msg.attach( MIMEText(MSG) )
if len(ATT)>0:
part = MIMEBase("application", "octet-stream")
part.set_payload(open(ATT, "rb").read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment; filename= %s' % os.path.basename(ATT))
msg.attach(part)
print 'Sending %s' % ATT
server.sendmail(FROM, TO, msg.as_string())
print 'Done'
server.close()
print 'All Done'
Subskrybuj:
Komentarze (Atom)