I created my first shell script. It's an audio logger that runs on the hour for an hour and restarts. Although if it is started within the hour it will only run until the end of the hour.
I've added it to Startup Applications with the command:
gnome-terminal -e /home/admin/Desktop/audiolog.sh
However when it starts up the text in terminal flickers and is resolved by maximizing the window but works fine. Any suggestions for improvements on my script or anything that is wrong? Thanks
#!/bin/sh
DAY=$(date +%d)
MO=$(date +%m)
YR=$(date +%y)
SE=$(date +%-S)
H=$(date +%H)
M=$(date +%M)
NOW=$(date)
DURATION=$(((60 - M) * 60-SE))
PART=$(find ./Documents/ -type f -name "LoggerAudio
${DAY}-${MO}-${YR}\ ${H}*" | wc -l)
reset
echo "Recording for $DAY $MO $YR - $H 00"
echo "Started at $NOW"
echo "- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- - - - - - - - - -"
if [ "$PART" -eq 0 ]
then
arecord -f cd -c 1 -d$DURATION -t raw -v -v | lame -b 128 -q2 -mm
-r - ./Documents/"LoggerAudio "$DAY-$MO-$YR\ $H"00".mp3
else
arecord -f cd -c 1 -d$DURATION -t raw -v -v | lame -b 128 -q2 -mm
-r - ./Documents/"LoggerAudio "$DAY-$MO-$YR\ $H"00 - Part - "$PART.mp3
fi
sleep 1s
./Desktop/audiolog.sh;