summaryrefslogtreecommitdiff
path: root/common.sh
diff options
context:
space:
mode:
authorAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2020-12-07 11:07:08 -0500
committerAlex Xu (Hello71) <alex_y_xu@yahoo.ca>2020-12-07 11:07:08 -0500
commitd127365cfac07dff8af75efbed95901d9ff6c0bc (patch)
treeb4060d9ec2b55cd313c7af46e3f20ab06a2c0d01 /common.sh
downloadsysupdate-d127365cfac07dff8af75efbed95901d9ff6c0bc.tar.xz
sysupdate-d127365cfac07dff8af75efbed95901d9ff6c0bc.zip
Initial commit
Diffstat (limited to 'common.sh')
-rwxr-xr-xcommon.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/common.sh b/common.sh
new file mode 100755
index 0000000..315a6a0
--- /dev/null
+++ b/common.sh
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+renice 15 $$
+ionice -c 3 -p $$
+
+cmd() {
+ while :; do
+ printf '[*] '
+ printf '%s ' "$@"
+ echo
+ if "$@"; then
+ break
+ else
+ printf "\"%s\" exited $?, dropping to shell... Exit 0 to retry, 2 to ignore, 3 to abort.\n" "$*"
+ $SHELL
+ case $? in
+ 2) break ;;
+ 3) exit 3 ;;
+ esac
+ fi
+ done
+}
+
+trap : INT