New function to exit sequence if another instance of it still runs
This commit is contained in:
@@ -7,9 +7,9 @@
|
|||||||
|
|
||||||
## Version information
|
## Version information
|
||||||
|
|
||||||
VERSION_REV=12
|
VERSION_REV=13
|
||||||
VERSION_MAJOR=2
|
VERSION_MAJOR=0
|
||||||
VERSION_MINOR=1
|
VERSION_MINOR=0
|
||||||
|
|
||||||
## Start of generic script part
|
## Start of generic script part
|
||||||
|
|
||||||
@@ -235,6 +235,19 @@ cat <<USAGE_API
|
|||||||
String which is displayed in the error output
|
String which is displayed in the error output
|
||||||
|
|
||||||
USAGE_API
|
USAGE_API
|
||||||
|
echo -e "${GREEN} exitIfRunning${NC}"
|
||||||
|
cat <<USAGE_API
|
||||||
|
End sequence if an instance of it is still running
|
||||||
|
|
||||||
|
USAGE_API
|
||||||
|
}
|
||||||
|
|
||||||
|
# check if there is another PID other than this one
|
||||||
|
exitIfRunning() {
|
||||||
|
if pidof -o %PPID -x "${0##*/}">>/dev/null; then
|
||||||
|
echoseq " [E] Sequence already running"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Echo only if not -qq ($QUIET -ne 2)
|
# Echo only if not -qq ($QUIET -ne 2)
|
||||||
|
Reference in New Issue
Block a user