вывод в командном режиме и URL
невозможно выполнить Python3 в cgi-bin URL выполняется через python2
#!/bin/python3.6
# Import modules for CGI handling
import cgi, cgitb, calendar, datetime, time, os, sys
from pyzabbix.api import ZabbixAPI
cgitb.enable()
print ("Content-type:text/html\r\n\r\n")
print ("<html>")
print ("<head>")
print ("<title>Zabbix Maintenance</title>")
print ("</head>")
print ("<body>")
x = datetime.datetime.now()
yy=x.strftime("%Y")
mm=x.strftime("%m")
dd=x.strftime("%d")
tim=x.strftime("%H:%M:%S")
print ('Current date and time of the Zabbix Server is:' + yy + ' ' + mm +' ' + dd +' ' + tim + ' ' +'Please convert maintenance window to Zabbix Server time$
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
if form.getvalue('first_name'):
first_name = form.getvalue('first_name')
print ('<h1> Hello ' + first_name + ' thanks for using script... </h1>')
server_name = form.getvalue('server_name')
print ('<h1> The server is ' + server_name + '</h1>')
Active_Since = form.getvalue('Active_Since')
s1=Active_Since.split("T")
s1=s1[0].split("-")
Y1=int(s1[0])
m1=int(s1[1])
d1=int(s1[2])
s1=Active_Since.split("T")
s1=s1[1].split(":")
H1=int(s1[0])
M1=int(s1[1])
dt1 = datetime.datetime(Y1,m1,d1,H1,M1)
a_s=time.mktime(dt1.timetuple())
#print(a_s)
a_s=str(a_s)
print ('<h1> The mm starts from ' + Active_Since + '</h1>')
active_till = form.getvalue('active_till')
t2=active_till.split("T")
t2=t2[0].split("-")
Y2=int(t2[0])
m2=int(t2[1])
d2=int(t2[2])
t2=active_till.split("T")
t2=t2[1].split(":")
H2=int(t2[0])
M2=int(t2[1])
dt2 = datetime.datetime(Y2,m2,d2,H2,M2)
a_t=time.mktime(dt2.timetuple())
#print(a_t)
a_t=str(a_t)
** Я не могу выполнить через URL, но из строки коммента могу выполнить оба вывода в образе **
который python / bin / python which python3 / usr / local / bin / python3 which python3 .6 /bin/python3.6