#!/bin/bash

echo $$ > /var/run/script.pid

echo 4 > /sys/class/gpio/unexport
echo 9 > /sys/class/gpio/unexport
echo 10 > /sys/class/gpio/unexport
echo 11 > /sys/class/gpio/unexport

sudo make clean
sudo make
sudo make upload
sudo python3 Rpi_to_server.py

pwd=$(pwd)
tps=$(cat temps.txt)
crontab -l | grep -v $pwd | crontab -
(crontab -l ; echo "*/$tps * * * * $pwd/python.sh $pwd") | crontab -
