Skip to content

Instantly share code, notes, and snippets.

@nakamkaz
Created September 30, 2017 14:21
Show Gist options
  • Save nakamkaz/1b5e6a4af0c5c93bd751cfabe09812a2 to your computer and use it in GitHub Desktop.
Save nakamkaz/1b5e6a4af0c5c93bd751cfabe09812a2 to your computer and use it in GitHub Desktop.
OpenBSD check config at first
# Utility Functions
#########################
loudrun() {
echo "RUN: '"$@"'"
$@
}
backupconf(){
local targetfile=$1
if [ -e "${targetfile}" ]; then
local fmd5=$(md5 ${targetfile} | awk '{print $NF}' )
loudrun cp -p "${targetfile}" "${targetfile}_${fmd5}.bak"
loudrun mv "${targetfile}_${fmd5}.bak" ./
else
echo ${targetfile} " not found"
fi
}
#########################
loudrun cat /etc/mygate
loudrun cat /etc/hostname.*
loudrun cat /etc/kbdtype
loudrun cat /etc/resolv.conf
# sh checklist.sh
RUN: 'cat /etc/mygate'
192.168.1.1
RUN: 'cat /etc/hostname.hvn0'
inet 192.168.1.119 255.255.255.0
up
rtsol
RUN: 'cat /etc/kbdtype'
us
RUN: 'cat /etc/resolv.conf'
lookup file bind
nameserver 192.168.1.1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment