#! /usr/bin/python

import RPi.GPIO as GPIO
import time
import subprocess
import sys

# GPIO setup
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

pin_num = 16

GPIO.setup(pin_num,GPIO.OUT)

start = time.time()

while time.time() - start <= 60:
    process = subprocess.Popen('/home/pi/bin/process_monitor.sh', stdout=subprocess.PIPE)
    line = process.stdout.readline()
    process.kill()
    if line != '':
        sys.exit()

GPIO.output(pin_num, 0)
