Kod: Markera allt
#!/bin/bash
for pid in $(pidof -x Volt.sh); do
if [ $pid != $$ ]; then
echo "[$(date)] : Volt.sh : Skiten är redan igång PID $pid"
exit 1
fi
done
function VoltAA {
COUNTER=0
while [ $COUNTER -lt 10 ]; do
VoltA=$(cat /mnt/1wire/20.18DF0A000000/volt.A)
if [ "$VoltA" == "" ]
then
let COUNTER=COUNTER+1
echo $NOW ";Fel på VoltA " >> /var/www/Felgivare.log
else
COUNTER=10
fi
done
}
function VoltBB {
COUNTER=0
while [ $COUNTER -lt 10 ]; do
VoltB=$(cat /mnt/1wire/20.18DF0A000000/volt.B)
if [ "$VoltB" == "" ]
then
let COUNTER=COUNTER+1
echo $NOW ";Fel på VoltB " >> /var/www/Felgivare.log
else
COUNTER=10
fi
done
}
function VoltCC {
COUNTER=0
while [ $COUNTER -lt 10 ]; do
VoltC=$(cat /mnt/1wire/20.18DF0A000000/volt.C)
if [ "$VoltC" == "" ]
then
let COUNTER=COUNTER+1
echo $NOW ";Fel på VoltC " >> /var/www/Felgivare.log
else
COUNTER=10
fi
done
}
function VoltDD {
COUNTER=0
while [ $COUNTER -lt 10 ]; do
VoltD=$(cat /mnt/1wire/20.18DF0A000000/volt.D)
if [ "$VoltD" == "" ]
then
let COUNTER=COUNTER+1
echo $NOW ";Fel på VoltD " >> /var/www/Felgivare.log
else
COUNTER=10
fi
done
}
for (( ; ; ))
do
clear
NOW=$(date +"%Y-%m-%d %H:%M:%S")
VoltAA
VoltBB
VoltCC
VoltDD
echo "$NOW ; $VoltA ; $VoltB ; $VoltC ; $VoltC" >> Volt_oraknad.csv
VoltA=$( echo $VoltA*5 | bc)
VoltB=$( echo $VoltB*5 | bc)
VoltC=$( echo $VoltC*5 | bc)
VoltD=$( echo $VoltD*5 | bc)
if [[ ${VoltA:0:1} == "." ]] ; then VoltA=$(echo 0$VoltA) ; fi
if [[ ${VoltB:0:1} == "." ]] ; then VoltB=$(echo 0$VoltB) ; fi
if [[ ${VoltC:0:1} == "." ]] ; then VoltC=$(echo 0$VoltC) ; fi
if [[ ${VoltD:0:1} == "." ]] ; then VoltD=$(echo 0$VoltD) ; fi
echo "$NOW; $VoltA; $VoltB; $VoltC; $VoltC" >> Volt.csv
sleep 10
done
Kod: Markera allt
echo 1 >power
Kod: Markera allt
apt-get update
apt-get upgrade
sudo apt-get -y install automake autoconf autotools-dev gcc g++ libtool libusb-dev libfuse-dev swig python2.7-dev tcl8.4-dev php5-dev make build-essential
cd /usr/src
sudo wget -O owfs-3.1p0.tar.gz http://downloads.sourceforge.net/project/owfs/owfs/3.1p0/owfs-3.1p0.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Fowfs%2Ffiles%2Fowfs%2F3.1p0%2F&ts=1430136504&use_mirror=vorboss
sudo tar xzvf owfs-3.1p0.tar.gz
cd /usr/src/owfs-3.1p0
sudo ./configure
sudo make -j 4 && sudo make install
sudo nano /etc/modprobe.d/blacklist.conf
# Prohibit interference with OWFS
blacklist ds2490
blacklist wire
sudo nano /etc/fuse.conf
#user_allow_other
till
user_allow_other
sudo mkdir /mnt/1wire
sudo /opt/owfs/bin/owfs -u --allow_other /mnt/1wire/
Kod: Markera allt
sudo /opt/owfs/bin/owfs --error_level 6 --error_print 2 -u --allow_other /mnt/1wire/
# Resultatet då blir
DEFAULT: ow_arg.c:(552) USB support (intentionally) not included in compilation. Check LIBUSB, then reconfigure and recompile.
DEBUG: ow_exit.c:(17) Exit code = 0
Kod: Markera allt
/bin/rm: cannot remove `libtoolT': No such file or directory
Current configuration:
Deployment location: /opt/owfs
Compile-time options:
USB is DISABLED
AVAHI is DISABLED
I2C is enabled
W1 is enabled
Parallel port DS1410E is enabled
Zeroconf/Bonjour is enabled
Debug-output is enabled
Mutexdebug is enabled
Profiling is DISABLED
Tracing memory allocation is DISABLED
Module configuration:
owlib is enabled
owshell is enabled
owfs is enabled
owhttpd is enabled
owftpd is enabled
owserver is enabled
owexternal is enabled
ownet is enabled
ownetlib is enabled
owtap is enabled
owmon is enabled
owcapi is enabled
swig is enabled
owperl is enabled
owphp is DISABLED
owpython is enabled
owtcl is enabled
Kod: Markera allt
sudo apt-get -y install automake autoconf autotools-dev gcc g++ libtool libusb-dev libfuse-dev swig python2.7-dev tcl8.4-dev php5-dev make build-essential