File: test_boot.sh

package info (click to toggle)
ufw 0.36.2-9
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,824 kB
  • sloc: python: 8,731; sh: 5,950; makefile: 200
file content (36 lines) | stat: -rwxr-xr-x 1,143 bytes parent folder | download | duplicates (7)
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
31
32
33
34
35
36
#!/bin/sh -e

#    Copyright 2010 Canonical Ltd.
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License version 3,
#    as published by the Free Software Foundation.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
#    WARNING: this script is not for production use. It's intended use is
#    for debugging.

user_and_host="$1"

count=0
while /bin/true ; do
    sleep 10
    out=`ssh -t $user_and_host 'sudo ufw status && sudo reboot' 2>&1` || {
        echo "Ssh command exited non-zero, trying again"
        continue
    }
    if echo "$out" | grep -q 'inactive'; then
        echo "FAILED after $count attempts: $out"
        exit 1
    fi
    echo "Success: $count: $out"
    count=$((count+1))
done