Linux
Server reboot + variants
Нормальная работа reboot проблемы с софтом reboot -f проблемы с ядром/маунтами/libc echo b>/proc/sysrq-trigger проблемы с ядром/маунтами/libc и нет открытой консоли ipt_SYSRQ (надо подготовить заранее) проблемы с ядром/железом ipmitool chassis power cycle проблемы с ядром/железом без открытой консоли ipmitool -H ipmi.server.local chassis power cycle проблемы с автономной переферией/БП/ipmi ребут через IP-розетку
Ubuntu 14.04 + grey screen in VNC
Fix: # apt-get install gnome-panel gnome-settings-daemon metacity nautilus gnome-terminal Use this ~/.vnc/xstartup file: #!/bin/sh export XKL_XMODMAP_DISABLE=1 unset SESSION_MANAGER unset DBUS_SESSION_BUS_ADDRESS [ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup [ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources xsetroot -solid grey vncconfig -iconic & gnome-panel & gnome-settings-daemon & metacity & nautilus & gnome-terminal & # or you can use […]
ESP8266 + temp/humidity + parse data for monitoring
My script to parse the data: #!/bin/sh #Temp S0=`/usr/local/bin/curl -v –silent –stderr – http://192.168.0.57/ | awk ‘/Temperature/{print $18}’` #Humidity #S1=`curl -v –silent –stderr – http://192.168.0.57/ | awk ‘/Humidity/{print substr($21,1,2) + 0}’ | bc -l` S1=`/usr/local/bin/curl -v –silent –stderr – http://192.168.0.57/ | awk ‘/Humidity/{print $21}’` /usr/local/bin/rrdtool update /var/rrdtool/db/esp.rrd N:$S0:$S1 WWWPREFIX=/usr/local/www/apache22/data/images RRDPREFIX=/var/rrdtool/db /usr/local/bin/rrdtool graph $WWWPREFIX/esp.png \ –width […]
PFX to key and crt in PEM
Extract Private Key: The following command will extract private key from .pfx file. You can find the private key in file named private_key.pem. # openssl pkcs12 -in myfile.pfx -nocerts -out private_key.pem -nodes Enter Import Password: MAC verified OK Extract Certificate: The following command will extract certificate from .pfx file. You can find the certificate […]
MySQLTuner tool
It’s here: http://mysqltuner.com/ Run it and then: mysqlcheck -u root -p –auto-repair –check –optimize –all-databases Go to my.cnf and add: query_cache_size = 268435456 query_cache_type=1 query_cache_limit=1048576 as it recommended.
CentOS + tmpfs
I saw this in a report: /etc/cron.daily/archiveSnort.sh: Out of memory (Needed 3608488 bytes) Just decided to extend tmpfs: Modify /etc/fstab line to look something like this: tmpfs /dev/shm tmpfs size=1g 0 0
Run scripts in background
Just add & in the end: /usr/local/etc/script.sh & Run without user session: nohup script.sh & or nohup script.sh > /dev/null & In autostart scripts (rc.d, init.d) just use &
Tcpdump examples
See the list of interfaces on which tcpdump can listen: tcpdump -D Listen on interface eth0: tcpdump -i eth0 Listen on any available interface (cannot be done in promiscuous mode. Requires Linux kernel 2.2 or greater): tcpdump -i any Be verbose while capturing packets: tcpdump -v Be more verbose while capturing packets: tcpdump -vv Be […]
DHCP debugging with tcpdump
http://sysadmin.wikia.com/wiki/DHCP_debugging_with_tcpdump tcpdump filter to match DHCP packets including a specific Client MAC Address: tcpdump -i br0 -vvv -s 1500 ‘((port 67 or port 68) and (udp[38:4] = 0x3e0ccf08))’ tcpdump filter to capture packets sent by the client (DISCOVER, REQUEST, INFORM): tcpdump -i br0 -vvv -s 1500 ‘((port 67 or port 68) and (udp[8:1] = 0x1))’