Server management cheat sheet
The snippet can be accessed without any authentication.
Authored by
Florian Klemenz
Edited
server-mgmt.bash 1.51 KiB
# Non-interactive release-upgrade
do-release-upgrade -f DistUpgradeViewNonInteractive
# Get IDRAC network configuration
/opt/dell/srvadmin/bin/idracadm7 getniccfg
# Get BMC network configuration
ipmitool lan print
# show controller/cache status
hpacucli ctrl all show status
hpacucli controller all show
hpacucli controller slot=0 show
# fuck IPv6
echo "net.ipv6.conf.all.disable_ipv6=1" >> /etc/sysctl.conf
echo "net.ipv6.conf.default.disable_ipv6=1" >> /etc/sysctl.conf
echo "net.ipv6.conf.lo.disable_ipv6=1" >> /etc/sysctl.conf
# Find processes using obsolete libraries
lsof | grep DEL
lsof | grep DEL.*libcrypto
# find processes in uninterruptable sleep ("D"-state)
ps aux | awk '$8 ~ /D/ { print $0 }'
# delete apache cache
htcacheclean -p /var/cache/apache2/mod_cache_disk/idm -a | grep jquery-ui-1.9.2.custom.css
htcacheclean -p /var/cache/apache2/mod_cache_disk/idm [URL]
# SSL - get and add cert
true | openssl s_client -connect google.com:443 2>/dev/null | openssl x509 > /usr/local/share/ca-certificates/google.crt
update-ca-certificates
# OPEN FILES
# Show processes with many open files
lsof | awk '{print $1}' | uniq -c | sort -rn | head
# open files per user
lsof | grep ' root ' | awk '{print $NF}' | sort | wc -l
# show open files per process
lsof -p $(pidof geth) | wc -l
# Show ulimits for process
cat /proc/$(pidof geth)/limits | grep files
# Set ulimits for process
prlimit -n150000 -p $(pidof geth)
# --> Find nultiple hardlinks to same file:
for i in `find .`; do stat -c %i $i; done | uniq -c | sort -nr
Please register or sign in to comment