#!/bin/bash PATH=/usr/local/bin:/usr/local/sbin:/bin:/sbin:/usr/bin:/usr/sbin date echo # eventually defines ntpsrv [[ -f /etc/mirrors.conf ]] && source /etc/mirrors.conf if [[ -x /root/backup.ksh && -x /root/upload.ksh ]]; then echo BACKUP echo time nice /root/backup.ksh echo echo UPLOAD echo time nice /root/upload.ksh echo else echo backup scripts not present echo fi # # SYSTEM # echo TIME SYNC echo if [[ -n $ntpsrv && -z `pgrep ntpd` && -z `pgrep chronyd` ]]; then ntpdate -u $ntpsrv elif [[ -x `which ntpctl 2>/dev/null` ]]; then ntpctl -s status elif [[ -x `which chronyc 2>/dev/null` ]]; then chronyc sources -a #chronyc selectdata -a else echo no time sync available fi echo [[ -x `which ntpq 2>/dev/null` ]] && ntpq -p && echo [[ -x `which adjtimex 2>/dev/null` ]] && adjtimex -p && echo # is this already done by the ntp daemon? echo -n hardware clock... hwclock --utc --systohc && echo done || echo FAIL echo echo WHO IS WHO echo w echo echo SERVICE STATUS echo /root/STATUS echo echo TOP 10 PROCESSES echo LINES=17 top -b -n1 -w # top 10 echo echo CLEAN PROCESS TREE echo # w/o wide to shorten jitsi process ps --pid 2 --ppid 2 --deselect uf echo echo MAIL QUEUE echo mailq echo # # NETWORK # echo WHAT IS MY IP echo ip=`curl -s ifconfig.me` # donno why cannot also ^ aside the $ reverse=`host $ip | awk '{print $NF}' | grep -E '[[:alnum:]-]{1,72}\.$'` echo $HOSTNAME public IP is $ip which resolves to $reverse unset ip reverse echo echo ROUTING TABLE echo netstat -rn echo echo ARP TABLE echo arp -a echo echo WHAT IS LISTENING echo netstat -lntupe echo echo ACTIVE CONNECTIONS echo netstat -atupe | grep -vE '0\.0\.0\.0:|\[::\]:' echo #echo CURRENTLY BLACK-LISTED IP ADDRESSES #echo #for ip in `cut -f4 -d'|' /var/lib/sshguard/enemies`; do # echo -e $ip:\ \\c # host -W 1 $ip #done; unset ip #cp /var/lib/sshguard/enemies /var/lib/sshguard/enemies.`date +%s` #echo #echo ACTIVE FILTERING RULES #echo #nft list ruleset #echo # assuming IP4 /24 for all interfaces #addresses=`ifconfig | grep 'inet ' | grep -v '127\.0\.0\.1' | awk '{print $2}'` #for address in $addresses; do # subnet=${address%\.*}/24 # echo PING SCAN $subnet # echo # time nmap -sn $subnet -oG - -T4 # echo # unset subnet #done; unset address #unset addresses # #echo ARP table \(after ping scan\) #echo #arp -a #echo # output differs depending on available sensors # hence we put it at the end to ease comparison of the messages if [[ -x `which sensors 2>/dev/null` ]]; then echo TEMPERATURE echo sensors else echo lm_sensors not installed fi echo # don't do that on current #slackpkg update #slackpkg -batch=on -default_answer=y upgrade-all