Last active
February 1, 2023 22:49
-
-
Save Naedri/5fffc83b84b1ce1fbde27eae108404b0 to your computer and use it in GitHub Desktop.
Revisions
-
Naedri revised this gist
Feb 1, 2023 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,8 @@ #!/bin/bash # To lock session if needed # loginctl lock-session echo && date echo 'Starting alarm.sh' -
Naedri revised this gist
Feb 1, 2023 . 3 changed files with 16 additions and 16 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash echo && date echo 'Starting alarm.sh' SOUND_PERCENT=150 SOUND_FREQUENCY=1000 @@ -16,7 +16,7 @@ pactl set-sink-volume $DEFAULT_SINK $SOUND_PERCENT% trap printout SIGINT printout() { echo "" echo "Alarm has stopped after $count loop(s)." exit } while : @@ -28,4 +28,4 @@ pactl set-sink-volume $DEFAULT_SINK $SOUND_PERCENT% ) echo && date echo "Finishing alarm.sh" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,13 +0,0 @@ This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ #!/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" -
Naedri revised this gist
Feb 1, 2023 . 2 changed files with 15 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ #!/bin/bash echo && date echo 'Starting alarm_stop.sh' for pid in $(ps aux | grep "alarm_trigger.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 alarm_stop.sh" This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ #!/bin/bash echo && date echo 'Starting alarm_trigger.sh' SOUND_PERCENT=150 SOUND_FREQUENCY=1000 @@ -28,4 +28,4 @@ pactl set-sink-volume $DEFAULT_SINK $SOUND_PERCENT% ) echo && date echo "Finishing alarm_trigger.sh" -
Naedri revised this gist
Feb 1, 2023 . 1 changed file with 2 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,13 +1,9 @@ #!/bin/bash echo && date echo 'Starting alarm.sh' SOUND_PERCENT=150 SOUND_FREQUENCY=1000 SOUND_DURATION=0.4s SOUND_PAUSE=0.1s @@ -19,6 +15,7 @@ pactl set-sink-volume $DEFAULT_SINK $SOUND_PERCENT% ( trap printout SIGINT printout() { echo "" echo "$count loop(s) have been necessary." exit } -
Naedri created this gist
Feb 1, 2023 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ #!/bin/bash # https://doc.ubuntu-fr.org/tutoriel/script_shell # https://doc.ubuntu-fr.org/projets/ecole/scripting/initiation_au_shell # https://stackoverflow.com/questions/46816904/bash-break-out-of-loop-with-ctrl-c-but-continue-with-script echo && date echo 'Starting alarm.sh' SOUND_PERCENT=20 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 "$count loop(s) have been necessary." 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"