Skip to content

Instantly share code, notes, and snippets.

@i-sync
Created August 10, 2017 04:43
Show Gist options
  • Save i-sync/509edf80e5afed51fc6451aa377587cf to your computer and use it in GitHub Desktop.
Save i-sync/509edf80e5afed51fc6451aa377587cf to your computer and use it in GitHub Desktop.
change raspberry pi volume follow the time one day
num=$(date "+%H")
t=$(date "+%F %T")
echo $num
if [ $num -le 5 ];then
amixer set PCM,0 80%
echo "$t ---> 60" >> /tmp/1.log
elif [ $num -gt 5 ]&&[ $num -lt 9 ];then
amixer set PCM,0 86%
echo "$t ---> 70" >> /tmp/1.log
elif [ $num -ge 9 ]&&[ $num -lt 13 ];then
amixer set PCM,0 94%
echo "$t ---> 80" >> /tmp/1.log
elif [ $num -ge 13 ]&&[ $num -lt 17 ];then
amixer set PCM,0 97%
echo "$t ---> 90" >> /tmp/1.log
elif [ $num -ge 17 ]&&[ $num -lt 21 ];then
amixer set PCM,0 94%
echo "$t ---> 80" >> /tmp/1.log
else [ $num -ge 21 ]&&[ $num -lt 23 ]
amixer set PCM,0 86%
echo "$t ---> 60" >> /tmp/1.log
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment