1209513Simp#!/bin/sh
2209513Simp#-
3209552Simp# Copyright (c) 2010 iXsystems, Inc.  All rights reserved.
4222528Sbz# Copyright (c) 2011 The FreeBSD Foundation
5222528Sbz# All rights reserved.
6209513Simp#
7222528Sbz# Portions of this software were developed by Bjoern Zeeb
8222528Sbz# under sponsorship from the FreeBSD Foundation.#
9222528Sbz#
10209513Simp# Redistribution and use in source and binary forms, with or without
11209513Simp# modification, are permitted provided that the following conditions
12209513Simp# are met:
13209513Simp# 1. Redistributions of source code must retain the above copyright
14209513Simp#    notice, this list of conditions and the following disclaimer.
15209513Simp# 2. Redistributions in binary form must reproduce the above copyright
16209513Simp#    notice, this list of conditions and the following disclaimer in the
17209513Simp#    documentation and/or other materials provided with the distribution.
18209513Simp#
19209513Simp# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
20209513Simp# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21209513Simp# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22209513Simp# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
23209513Simp# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24209513Simp# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25209513Simp# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26209513Simp# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27209513Simp# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28209513Simp# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29209513Simp# SUCH DAMAGE.
30209513Simp#
31209513Simp# $FreeBSD$
32209513Simp
33209513Simp
34222528Sbz# Script which tries to ping "home" to see if Internet connectivity is
35222528Sbz# available.
36209513Simp#############################################################################
37209513Simp
38209513Simprm ${TMPDIR}/.testftp >/dev/null 2>/dev/null
39209513Simp
40209513Simpping -c 2 www.pcbsd.org >/dev/null 2>/dev/null
41209513Simpif [ "$?" = "0" ]
42209513Simpthen
43211730Simp  echo "ftp: Up"
44211730Simp  exit 0
45209513Simpfi
46209513Simp
47222528Sbzping6 -c 2 www.pcbsd.org >/dev/null 2>/dev/null
48222528Sbzif [ "$?" = "0" ]
49222528Sbzthen
50222528Sbz  echo "ftp: Up"
51222528Sbz  exit 0
52222528Sbzfi
53222528Sbz
54209513Simpping -c 2 www.freebsd.org >/dev/null 2>/dev/null
55209513Simpif [ "$?" = "0" ]
56209513Simpthen
57211730Simp  echo "ftp: Up"
58211730Simp  exit 0
59209513Simpfi
60222528Sbz
61222528Sbzping6 -c 2 www.freebsd.org >/dev/null 2>/dev/null
62222528Sbzif [ "$?" = "0" ]
63222528Sbzthen
64222528Sbz  echo "ftp: Up"
65222528Sbz  exit 0
66222528Sbzfi
67222528Sbz
68209513Simpecho "ftp: Down"
69209513Simpexit 1
70