Last active
February 1, 2023 22:49
-
-
Save Naedri/5fffc83b84b1ce1fbde27eae108404b0 to your computer and use it in GitHub Desktop.
To retrieve my laptop quickly
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# To lock session if needed | |
# loginctl lock-session | |
echo && date | |
echo 'Starting alarm.sh' | |
SOUND_PERCENT=150 | |
SOUND_FREQUENCY=1000 | |
SOUND_DURATION=0.4s | |
SOUND_PAUSE=0.1s | |
DEFAULT_SINK=`pactl get-default-sink` | |
pactl set-sink-mute $DEFAULT_SINK 0 | |
pactl set-sink-volume $DEFAULT_SINK $SOUND_PERCENT% | |
( | |
trap printout SIGINT | |
printout() { | |
echo "" | |
echo "Alarm has stopped after $count loop(s)." | |
exit | |
} | |
while : | |
do | |
((count++)) | |
speaker-test --frequency $SOUND_FREQUENCY --test sine & sleep $SOUND_DURATION && kill -9 $! | |
sleep $SOUND_PAUSE | |
done | |
) | |
echo && date | |
echo "Finishing alarm.sh" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo && date | |
echo 'Starting stop.sh' | |
for pid in $(ps aux | grep "alarm.sh" | awk '{print $2}'); do kill -9 $pid; done | |
sleep 1s | |
for pid in $(ps aux | grep "speaker-test" | awk '{print $2}'); do kill -9 $pid; done | |
echo && date | |
echo "Finishing stop.sh" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment