File: dar_check

package info (click to toggle)
dar 2.8.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,024 kB
  • sloc: cpp: 86,219; sh: 6,978; ansic: 895; makefile: 489; python: 242; csh: 115; perl: 43; sed: 16
file content (30 lines) | stat: -rwxr-xr-x 567 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash

if [ -z "$1" ] ; then
    echo "usage: $0 <command>"
    echo ""
    echo "example: $0 ./failer 3"
    exit 1
fi

loopit=0
sleeptime=10

while ! $* ; do
    # we reset the terminal:
    reset
    loopit=$(( $loopit + 1 ))
    echo "Failure number $loopit. Sleeping $sleeptime seconds and retring"
    sleep $sleeptime
done

if [ $loopit -eq 0 ] ; then
    echo "The command [$*] has completed without retry"
else
    printf "The command [$*] has completed but needed $loopit retr"
    if [ $loopit -gt 1 ] ; then
	echo "ies"
    else
	echo "y"
    fi
fi