1
0
mirror of https://github.com/AG7GN/nexus-utilities.git synced 2025-05-18 07:30:07 -07:00

Fixed trap actions

This commit is contained in:
Steve Magnuson 2020-02-08 10:14:38 -08:00
parent 7993b2f1d1
commit c70dfaa1ae

16
tnc.sh
View File

@ -97,7 +97,7 @@
#%
#================================================================
#- IMPLEMENTATION
#- version ${SCRIPT_NAME} 3.3.2
#- version ${SCRIPT_NAME} 3.3.6
#- author Steve Magnuson, AG7GN
#- license CC-BY-SA Creative Commons License
#- script_id 0
@ -125,16 +125,12 @@ DEBUG=false
function TrapCleanup () {
${SCRIPT_NAME} stop
rm -f /tmp/tnc*
rm -f $CONFFILE
exit 0
}
function SafeExit () {
${SCRIPT_NAME} stop
rm -f /tmp/tnc*
rm -f $CONFFILE
trap - INT TERM EXIT
exit
}
@ -151,12 +147,12 @@ function ScriptInfo() {
function Usage () {
printf "Usage:\n"
ScriptInfo usage
exit 1
exit 0
}
function Die () {
echo "${*}"
SafeExit
exit 1
}
#---------------------------------------
@ -468,7 +464,8 @@ shift $((${OPTIND} - 1)) ## shift options
#============================
# Trap bad exits with cleanup function
trap SafeExit EXIT INT TERM
trap TrapCleanup INT
trap SafeExit TERM EXIT
# Exit on error. Append '||true' when you run the script if you expect an error.
set -o errexit
@ -592,7 +589,7 @@ case "$ACTION" in
[[ "$SCR" != "" ]] && { pkill piardop2; $SCREEN -S $SCR -X quit; }
done
## Kill existing session if it exists
pgrep kissattach >/dev/null && kill $(pgrep kissattach)
pgrep kissattach >/dev/null && sudo kill $(pgrep kissattach)
## Are the apps installed?
for i in kissattach kissparms
do
@ -772,5 +769,4 @@ case "$ACTION" in
Usage
;;
esac
SafeExit