#!/usr/bin/python2 import time import os #skript na vypnuti #predtim shodi motion, pir.py, sambu a ftp server #David Pleskot, 2016 os.system('echo '' >vyp.log') #vymazu predesly zapis if os.path.isfile('/home/pi/motion.pid'): #vypnu motion f=open('/home/pi/motion.pid','r') os.system('sudo kill '+f.readline()[:-1]+' >/home/pi/vyp.log 2>&1') f.close() time.sleep(5) os.system('pidof -x pir.py >/home/pi/ramdisk/pir') #vypnu pir.py f=open('/home/pi/ramdisk/pir','r') os.system('sudo kill -KILL '+f.readline()[:-1]+' >>/home/pi/vyp.log 2>&1') f.close() time.sleep(5) os.system('sudo service smbd stop >>/home/pi/vyp.log 2>&1') #vypnu sambu time.sleep(7) os.system('sudo service pure-ftpd stop >>/home/pi/vyp.log 2>&1') #vypnu ftp server time.sleep(7) os.system('ps -e|grep pir.py >>/home/pi/vyp.log') #kontrola os.system('ps -e|grep motion >>/home/pi/vyp.log') os.system('ps -e|grep smbd >>/home/pi/vyp.log') os.system('ps -e|grep ftpd >>/home/pi/vyp.log') os.system("sudo shutdown now")