Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- maxVol=45
- maxSec=90
- interval=1
- while true; do
- sleep $interval
- curV=$(amixer -c 0 sget Master | grep -Po "(\d\d)%" | grep -Po "\d*")
- pcmV=$(amixer -c 0 sget PCM | grep -Po "(\d\d)%" | grep -Po "\d*")
- spkV=$(amixer -c 0 sget Speaker | grep -Po "(\d\d)%" | grep -Po "\d*")
- if [ $curV ]; then
- if [ $curV -gt $maxVol ]; then
- resetV=$(amixer -c 0 sset Master $maxVol%)
- fi
- if [ $curV -gt $maxSec ]; then
- resetV=$(amixer -c 0 sset PCM $maxSec%)
- fi
- if [ $spkV -gt $maxSec ]; then
- resetV=$(amixer -c 0 sset Speaker $maxSec%)
- fi
- fi
- done &
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement