Fernsteuerung (3)
Thema: TX Fernsteuerung 3. Teil
Datum: 14.2.2015, 09.00 Uhr
Referent: Walter Schmutz, HB9AGA
Abgegebene Unterlage Kurs vom Samstag, 14.02.15:
Keywords:
/var/www/index.html
/etc/apache2/sites-available/default
DocumentRoot
/usr/lib/cgi-bin/test.py
Schwerpunkt:
Eingabe einer Frequenz in URL und Uebergabe in auszufuehrendes program
Grundlagen:
http://www.tutorialspoint.com/python/python_cgi_programming.htm
Linux debian:
/var/www/index.html
/usr/lib/cgi-bin/test.py
/usr/lib/cgi-bin/freq.py
Versuche mit folgendem Programm:
#!/usr/bin/python
# Import modules for CGI handling
import cgi, cgitb
# Create instance of FieldStorage
form = cgi.FieldStorage()
# Get data from fields
first_name = form.getvalue('first_name')
last_name = form.getvalue('last_name')
print "Content-type:text/html\r\n\r\n"
print "<html>"
print "<head>"
print "<title>Hello - Second CGI Program</title>"
print "</head>"
print "<body>"
print "<h2>Hello %s %s</h2>" % (first_name, last_name)
print "</body>"
print "</html>"
Eingabe auf pc:
http://192.168.0.78/cgi-bin/test.py?first_name=thierry&last_name=mcarthur
---------------
execute program
---------------
#!/usr/bin/python
import os
os.system("/bin/cp /radio/aa /radio/bb")
--------------------------------------------------------
backup
/ra.tar
/cgi.tar
Zugriffe heute: 2 - gesamt: 2381.