Skip to content
Snippets Groups Projects
Unverified Commit c4ec24de authored by David Beniamine's avatar David Beniamine
Browse files

some documentation

parent 610e1626
Branches
No related tags found
No related merge requests found
# Script utils
## Healthreport
## Dependencies
systemd
aptitude
debian-goodies
ufw
cpufreq-utils
lm-sensors
pandoc
The following scripts must be in the same directory
getip.sh
## Install
Add the crontab entry
0 7 * * 1 /path/to/healthReport.sh -m "Weekly health report" 2> /dev/null
getip.sh 0 → 100755
#!/bin/bash
isIP()
{
ret=1
ip=$1
if [[ $ip=~^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]
then
OIFS=$IFS
IFS='.'
ip=($1)
IFS=$OIFS
[[ ${ip[0]} -le 255 && ${ip[1]} -le 255 && ${ip[2]} -le 255 && ${ip[3]} -le 255 ]]
ret=$?
fi
return $ret
}
#Parse IP from sfr/orange box
myip=$(curl $(/sbin/route | grep default | /usr/bin/awk {'print $2'}) \
| grep "Adresse IP" -A 1 | /usr/bin/tail -n 1 |\
sed -e "s/.*>[^0-9]*\([0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\)[^0-9]*<.*/\1/g")
if isIP $myip
then
echo "External IP is : $myip"
exit 0
fi
#Old bad method using hosts, usable if the first method fail
Hosts=("icanhazip.com" "ident.me" "ipecho.net/plain" \
"whatismyip.akamai.com" "tnx.nl/ip" "myip.dnsomatic.com" \
"ip.appspot.com" "ip.telize.com" "curlmyip.com" "ifconfig.me" )
for h in ${Hosts[@]}
do
myip=$(curl -s $h)
if isIP $myip
then
echo "External IP is : $myip"
exit 0
fi
done
...@@ -16,8 +16,8 @@ ...@@ -16,8 +16,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
sendername="Tetras Libre" sendername="root@`hostname`"
recipient="$sendername <admin@tetras-libre.fr>" recipient="root"
level=info level=info
date="$(date +%y%m%d_%H%M)" date="$(date +%y%m%d_%H%M)"
archiveFile="HealthReport-$date.tar.xz" archiveFile="HealthReport-$date.tar.xz"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment