Add shells cripts
This commit is contained in:
parent
7e6fc09f72
commit
a96d932c14
7 changed files with 102 additions and 0 deletions
9
acatcher/convert_audio.sh
Executable file
9
acatcher/convert_audio.sh
Executable file
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
# Signed 16 bit Little Endian, Rate 22050 Hz, Mono
|
||||
#
|
||||
# use "play" command to play back audio
|
||||
|
||||
INFILE="$1"
|
||||
OUTFILE="$INFILE.wav"
|
||||
#sox -r 44100 -e unsigned -b 8 -c 1 <RAW_FILE> <TARGET_FILE>
|
||||
sox -r 22050 -e signed -b 16 -L -c 1 "$1" "$OUTFILE"
|
18
acatcher/mkacatcher_cpp.sh
Executable file
18
acatcher/mkacatcher_cpp.sh
Executable file
|
@ -0,0 +1,18 @@
|
|||
#!/bin/sh
|
||||
NUM=0
|
||||
while read FOO; do
|
||||
if ! echo $FOO | grep -q ^#; then
|
||||
HOST="`echo $FOO | cut -d\| -f3`"
|
||||
MAC="`echo $FOO | cut -d\| -f1 | tr '[A-Z]' '[a-z]'`"
|
||||
IP="`echo $FOO | cut -d\| -f2`"
|
||||
if ! echo $HOST | egrep -q "(server|spare)"; then
|
||||
>&2 echo found host $HOST mac $MAC ip $IP num $NUM
|
||||
HEX="`echo "obase=16; $NUM" | bc | tr '[A-Z]' '[a-z]'`"
|
||||
echo "\"[$HEX] $HOST\","
|
||||
NUM=$((NUM+1))
|
||||
elif echo $HOST | grep -q server; then
|
||||
>&2 echo found server at ip $IP
|
||||
echo $IP > SERVERIP
|
||||
fi
|
||||
fi
|
||||
done < $HOME/Dropbox/CAMS > acatcher.cxx.inc
|
17
acatcher/mkhosts.sh
Executable file
17
acatcher/mkhosts.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
NUM=0
|
||||
while read FOO; do
|
||||
if ! echo $FOO | grep -q ^#; then
|
||||
HOST="`echo $FOO | cut -d\| -f3`"
|
||||
MAC="`echo $FOO | cut -d\| -f1 | tr '[A-Z]' '[a-z]'`"
|
||||
IP="`echo $FOO | cut -d\| -f2`"
|
||||
if ! echo $HOST | egrep -q "(server|spare)"; then
|
||||
>&2 echo found host $HOST mac $MAC ip $IP num $NUM
|
||||
echo "$HOST|$MAC|$IP|$NUM"
|
||||
NUM=$((NUM+1))
|
||||
elif echo $HOST | grep -q server; then
|
||||
>&2 echo found server at ip $IP
|
||||
echo $IP > SERVERIP
|
||||
fi
|
||||
fi
|
||||
done < $HOME/Dropbox/CAMS > HOSTS
|
21
acatcher/provision_streamers.sh
Executable file
21
acatcher/provision_streamers.sh
Executable file
|
@ -0,0 +1,21 @@
|
|||
#!/bin/sh
|
||||
NUM=0
|
||||
while read FOO; do
|
||||
if ! echo $FOO | grep -q ^#; then
|
||||
HOST="`echo $FOO | cut -d\| -f3`"
|
||||
MAC="`echo $FOO | cut -d\| -f1 | tr '[A-Z]' '[a-z]'`"
|
||||
IP="`echo $FOO | cut -d\| -f2`"
|
||||
if ! echo $HOST | egrep -q "(server|spare)"; then
|
||||
>&2 echo provisining host $HOST mac $MAC ip $IP num $NUM
|
||||
ssh pi@$HOST "if [ ! -d \$HOME/.ssh ]; then mkdir \$HOME/.ssh; fi; echo `cat $HOME/.ssh/id_rsa.pub` >> \$HOME/.ssh/authorized_keys; chmod 700 \$HOME/.ssh; chmod 644 \$HOME/.ssh/authorized_keys"
|
||||
for FILE in HOSTS SERVERIP stream.sh set_hostname.sh v4lcap.c; do scp $FILE pi@$HOST:$FILE; done
|
||||
ssh pi@$HOST "make v4lcap"
|
||||
ssh pi@$HOST "bash set_hostname.sh"
|
||||
ssh pi@$HOST "sudo reboot"
|
||||
NUM=$((NUM+1))
|
||||
elif echo $HOST | grep -q server; then
|
||||
>&2 echo found server at ip $IP
|
||||
echo $IP > SERVERIP
|
||||
fi
|
||||
fi
|
||||
done < $HOME/Dropbox/CAMS
|
17
acatcher/start_streamers.sh
Executable file
17
acatcher/start_streamers.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
NUM=0
|
||||
while read FOO; do
|
||||
if ! echo $FOO | grep -q ^#; then
|
||||
HOST="`echo $FOO | cut -d\| -f3`"
|
||||
MAC="`echo $FOO | cut -d\| -f1 | tr '[A-Z]' '[a-z]'`"
|
||||
IP="`echo $FOO | cut -d\| -f2`"
|
||||
if ! echo $HOST | egrep -q "(server|spare)"; then
|
||||
>&2 echo starting up host $HOST mac $MAC ip $IP num $NUM
|
||||
ssh pi@$HOST "screen -dm bash stream.sh"
|
||||
NUM=$((NUM+1))
|
||||
elif echo $HOST | grep -q server; then
|
||||
>&2 echo found server at ip $IP
|
||||
echo $IP > SERVERIP
|
||||
fi
|
||||
fi
|
||||
done < $HOME/Dropbox/CAMS
|
3
acatcher/start_watcher.sh
Executable file
3
acatcher/start_watcher.sh
Executable file
|
@ -0,0 +1,3 @@
|
|||
#!/bin/sh
|
||||
echo "*** NOTE wait a few then run fix_windows.sh in a different wimdow ***"
|
||||
./acatcher | (aplay -t raw -c 1 -f S16_LE -r 22050 > /dev/null 2> /dev/null)
|
17
acatcher/stop_streamers.sh
Executable file
17
acatcher/stop_streamers.sh
Executable file
|
@ -0,0 +1,17 @@
|
|||
#!/bin/sh
|
||||
NUM=0
|
||||
while read FOO; do
|
||||
if ! echo $FOO | grep -q ^#; then
|
||||
HOST="`echo $FOO | cut -d\| -f3`"
|
||||
MAC="`echo $FOO | cut -d\| -f1 | tr '[A-Z]' '[a-z]'`"
|
||||
IP="`echo $FOO | cut -d\| -f2`"
|
||||
if ! echo $HOST | egrep -q "(server|spare)"; then
|
||||
>&2 echo killing host $HOST mac $MAC ip $IP num $NUM
|
||||
ssh pi@$HOST "screen -X quit"
|
||||
NUM=$((NUM+1))
|
||||
elif echo $HOST | grep -q server; then
|
||||
>&2 echo found server at ip $IP
|
||||
echo $IP > SERVERIP
|
||||
fi
|
||||
fi
|
||||
done < $HOME/Dropbox/CAMS
|
Loading…
Add table
Add a link
Reference in a new issue