Compare commits

..

No commits in common. "433c83b393f6f056cbb6896a5780d6c0e8129f41" and "8e2490e6bcab0b2f99eb753de370c6d2dda3e2f1" have entirely different histories.

3 changed files with 6 additions and 18 deletions

View File

@ -1,7 +1,6 @@
{ {
"name": "Virtual DSM", "name": "Virtual DSM",
"service": "vdsm", "service": "vdsm",
"forwardPorts": [5000],
"portsAttributes": { "portsAttributes": {
"5000": { "5000": {
"label": "Web", "label": "Web",

View File

@ -33,7 +33,6 @@ _trap() {
finish() { finish() {
local pid local pid
local cnt=0
local reason=$1 local reason=$1
touch "$QEMU_END" touch "$QEMU_END"
@ -41,24 +40,14 @@ finish() {
if [ -s "$QEMU_PID" ]; then if [ -s "$QEMU_PID" ]; then
pid=$(<"$QEMU_PID") pid=$(<"$QEMU_PID")
echo && error "Forcefully terminating Virtual DSM, reason: $reason..." echo && error "Forcefully terminating QEMU process, reason: $reason..."
{ kill -15 "$pid" || true; } 2>/dev/null { kill -15 "$pid" || true; } 2>/dev/null
while isAlive "$pid"; do while isAlive "$pid"; do
sleep 1 sleep 1
cnt=$((cnt+1))
# Workaround for zombie pid # Workaround for zombie pid
[ ! -s "$QEMU_PID" ] && break [ ! -s "$QEMU_PID" ] && break
if [ "$cnt" == "5" ]; then
echo && error "QEMU did not terminate itself, forcefully killing process..."
{ kill -9 "$pid" || true; } 2>/dev/null
fi
done done
fi fi
fKill "print.sh" fKill "print.sh"

View File

@ -13,7 +13,7 @@ escape () {
return 0 return 0
} }
path="$1" file="$1"
total="$2" total="$2"
body=$(escape "$3") body=$(escape "$3")
@ -24,20 +24,20 @@ fi
while true while true
do do
if [ ! -s "$path" ] && [ ! -d "$path" ]; then if [ ! -s "$file" ] && [ ! -d "$file" ]; then
bytes="0" bytes="0"
else else
bytes=$(du -sb "$path" | cut -f1) bytes=$(du -sb "$file" | cut -f1)
fi fi
if (( bytes > 4096 )); then if (( bytes > 1000 )); then
if [ -z "$total" ] || [[ "$total" == "0" ]] || [ "$bytes" -gt "$total" ]; then if [ -z "$total" ] || [[ "$total" == "0" ]] || [ "$bytes" -gt "$total" ]; then
size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/') size=$(numfmt --to=iec --suffix=B "$bytes" | sed -r 's/([A-Z])/ \1/')
else else
size="$(echo "$bytes" "$total" | awk '{printf "%.1f", $1 * 100 / $2}')" size="$(echo "$bytes" "$total" | awk '{printf "%.1f", $1 * 100 / $2}')"
size="$size%" size="$size%"
fi fi
[[ "$size" != "0.0%" ]] && echo "${body//(\[P\])/($size)}"> "$info" echo "${body//(\[P\])/($size)}"> "$info"
fi fi
sleep 1 & wait $! sleep 1 & wait $!