1. Jack Frost
  2. pickaxe

Commits

Jack Frost  committed 5e1f2e8

creeper: removed blib dependency

  • Participants
  • Parent commits 1d8c1fb
  • Branches master

Comments (0)

Files changed (1)

File creeper

View file
  • Ignore whitespace
 # /config
 
 ## functions
-source '/opt/bashlib/bashlib'
+blib.sys.pid_check() {
+	[[ "$1" ]] || {
+		echo "usage: blib.sys.pid_check PID" >&2
+		return 1
+	}
+
+	ps -p "$1" &>/dev/null
+}
+
+blib.sys.pid_wait() {
+	local rc='0'
+	local timeout="$2"
+	[[ "$timeout" ]] || { timeout='30'; }
+
+	echo -n "Waiting for PID to exit: $1..."
+
+	while [[ "$counter" -lt "$timeout" ]] && { blib.sys.pid_check "$1"; }; do
+		echo -n '.'
+		sleep 1
+		local counter=$[counter+1]
+		[[ "$counter" -ge "$timeout" ]] && { echo 'timeout'; local rc='1'; }
+	done
+
+	echo; return "$rc"
+}
 
 creeper.usage() {
 	local script_name=`basename $0`