summaryrefslogtreecommitdiff
path: root/common.sh
blob: 315a6a0794637e9b6ddb8e1833f04a8b2edb164d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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