mirror of https://bitbucket.org/ausocean/av.git
SCUHU: configure SCUHU and add services and scripts to run at startup on pi
This is so that the software required for SCUHU will run at startup on the pi. Approved-by: Alan Noble Approved-by: Saxon Milton
This commit is contained in:
parent
a266587397
commit
ba550e286a
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"BitDepth": "16",
|
||||
"Channels": "1",
|
||||
"Input": "audio",
|
||||
"InputCodec": "pcm",
|
||||
"MaxFileSize": "172800000",
|
||||
"Output": "File",
|
||||
"OutputPath": "/home/pi/recordings/audio-",
|
||||
"RecPeriod": "1",
|
||||
"SampleRate": "48000",
|
||||
"logging": "Debug",
|
||||
"mode": "Normal",
|
||||
"PSITime": "10"
|
||||
}
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Startup service for SCUHU, primarily configures and runs rvcl to record audio to file.
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/home/pi/go/src/bitbucket.org/ausocean/av/scripts/scuhu_run.sh
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,49 @@
|
|||
#!/bin/sh -e
|
||||
# This script configures and runs a binary on a pi, intended to run at boot time.
|
||||
BINNAME=rvcl
|
||||
ARGS="-config-file config-scuhu.json"
|
||||
|
||||
echo Set kernel parameters:
|
||||
# kernel settings to improve performance on Raspberry Pi
|
||||
# tell Linux to fork optimistically
|
||||
sudo sysctl -w vm.overcommit_memory=1
|
||||
# minimize swapping, without disabling it completely
|
||||
sudo sysctl -w vm.swappiness=1
|
||||
|
||||
# turn off the pi LED to conserve power
|
||||
echo default-on | sudo tee /sys/class/leds/led0/trigger
|
||||
echo none | sudo tee /sys/class/leds/led0/trigger
|
||||
|
||||
# the following required directories _should_ already exist
|
||||
if [ ! -d /var/log/netsender ]; then
|
||||
sudo mkdir /var/log/netsender
|
||||
chmod guo+rwx /var/log/netsender
|
||||
fi
|
||||
if [ ! -d /var/netsender ]; then
|
||||
sudo mkdir /var/netsender
|
||||
chmod guo+rwx /var/netsender
|
||||
fi
|
||||
|
||||
# show IP addresses
|
||||
echo Our IP addresses:
|
||||
sudo ip addr show | grep inet
|
||||
|
||||
# capture stdout and stderr to a secondary log file (just in case)
|
||||
exec 2> /var/log/netsender/stream.log
|
||||
exec 1>&2
|
||||
|
||||
# set env, working dir and run as pi user
|
||||
HOME=/home/pi
|
||||
GOPATH=$HOME/go
|
||||
BINPATH=$GOPATH/src/bitbucket.org/ausocean/av/exp/$BINNAME
|
||||
PATH=$PATH:/usr/local/go/bin:$BINPATH
|
||||
cd $BINPATH
|
||||
sudo HOME=$HOME GOPATH=$GOPATH PATH=$PATH ./$BINNAME $ARGS
|
||||
if [ $? -eq 0 ]
|
||||
then
|
||||
echo "Successfully exited $BINNAME"
|
||||
exit 0
|
||||
else
|
||||
echo "$BINNAME exited with code: $?" >&2
|
||||
exit 1
|
||||
fi
|
|
@ -0,0 +1,10 @@
|
|||
[Unit]
|
||||
Description=Used to turn the pi's wifi off after a set delay after startup.
|
||||
|
||||
[Service]
|
||||
Type=simple
|
||||
ExecStart=/home/pi/go/src/bitbucket.org/ausocean/av/scripts/wifi-off-delay_run.sh
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
|
@ -0,0 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
#This script is intended to run at startup and will turn the wifi interface off if it has not connected to an SSID in 5 minutes.
|
||||
|
||||
sleep 300
|
||||
|
||||
if iwconfig wlan0 | grep -q "ESSID:off/any"; then
|
||||
sudo ifconfig wlan0 down
|
||||
fi
|
Loading…
Reference in New Issue