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:
parent
7993b2f1d1
commit
c70dfaa1ae
24
tnc.sh
24
tnc.sh
@ -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
|
||||
@ -123,22 +123,18 @@ DEBUG=false
|
||||
# FUNCTIONS
|
||||
#============================
|
||||
|
||||
function TrapCleanup() {
|
||||
function TrapCleanup () {
|
||||
${SCRIPT_NAME} stop
|
||||
rm -f /tmp/tnc*
|
||||
rm -f $CONFFILE
|
||||
exit 0
|
||||
}
|
||||
|
||||
function SafeExit() {
|
||||
${SCRIPT_NAME} stop
|
||||
function SafeExit () {
|
||||
rm -f /tmp/tnc*
|
||||
rm -f $CONFFILE
|
||||
trap - INT TERM EXIT
|
||||
exit
|
||||
}
|
||||
|
||||
function ScriptInfo() {
|
||||
function ScriptInfo () {
|
||||
HEAD_FILTER="^#-"
|
||||
[[ "$1" = "usage" ]] && HEAD_FILTER="^#+"
|
||||
[[ "$1" = "full" ]] && HEAD_FILTER="^#[%+]"
|
||||
@ -148,15 +144,15 @@ function ScriptInfo() {
|
||||
-e "s/\${SCRIPT_NAME}/${SCRIPT_NAME}/g"
|
||||
}
|
||||
|
||||
function Usage() {
|
||||
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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user