Add check for running thunderbird and offer to stop it
This commit is contained in:
parent
ad11bc88e4
commit
5c5e293d1c
@ -1,6 +1,41 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
|
# exit thunderbird
|
||||||
|
fn_killbird() {
|
||||||
|
# kill thunderbird
|
||||||
|
pkill thunderbird
|
||||||
|
# wait for a bit before checking again
|
||||||
|
sleep 5s
|
||||||
|
}
|
||||||
|
|
||||||
|
# check if thunderbird is running
|
||||||
|
fn_checkbird() {
|
||||||
|
# check for thunderbird using pgrep
|
||||||
|
while [ $(pgrep thunderbird) ]; do
|
||||||
|
# get user input whether to shut down or exit
|
||||||
|
# default is exiting
|
||||||
|
read -p "Thunderbird is running. Do you want to shut it down now? [yN]: " yn
|
||||||
|
case $yn in
|
||||||
|
# handle closing thunderbird
|
||||||
|
[Yy]*)
|
||||||
|
fn_killbird
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
# explicit no, exit
|
||||||
|
[Nn]*)
|
||||||
|
echo "Please close Thunderbird and try again."
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
# implicit no, exit
|
||||||
|
*)
|
||||||
|
echo "Please close Thunderbird and try again."
|
||||||
|
exit
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# prompt for password
|
# prompt for password
|
||||||
echo -n "Password: "
|
echo -n "Password: "
|
||||||
read -s -r pass
|
read -s -r pass
|
||||||
@ -17,6 +52,9 @@ if [ ! "$pass" = "$pass2" ]; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# check if thunderbird is running
|
||||||
|
fn_checkbird
|
||||||
|
|
||||||
# go to home dir
|
# go to home dir
|
||||||
cd "$HOME"
|
cd "$HOME"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user