Rexxer

Some tips for me and other

Linux

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))’

Shell + echo a random string from a file

shuf -n 1 /usr/local/etc/file.txt

Arduino Uno + Ubuntu + Firmware + command line

1. Install avrdude: sudo apt-get install avrdude 2. Run the command: avrdude -F -V -c arduino -p ATMEGA328P -P /dev/ttyUSB0 -b 115200 -U flash:w:firmware.hex

RRDTool script

Very usefull script for RRDTool. Was copy-pasted from someones blog (can’t recollect the link) – thanks to the author. #!/bin/bash # Путь к исполнимому файлу rrdtool RRDTOOL=/usr/bin/rrdtool # Путь к базе, в которой храниться температура DATABASE=/usr/local/rrd/space-temperature.rrd # Периодичность поступления данных в базу (сек) – соответственно должен быть настроен CRON PERIOD=60 # Команда для получения текущей […]

PFSense + Sarg reports

I met a strange behavior in PFSense Sarg module. Reports didn’t appear and sarg index.html didn’t generated. Work config for success report: Report Options /usr/pbi/sarg-amd64/etc/sarg/sarg.conf: user graphics remove temporary files generate the main index generate the index tree overwrite report use comma instead pint in reports report_type topusers topsites sites_users users_sites date_time denied auth_failures site_user_time_date […]

Another script for temperature monitoring on PFSense

Just the script: #!/bin/sh cd /usr/local/etc S0=`/usr/local/etc/digitemp_DS9097 -t 0 -q -s /dev/cuau0 -o\%.C` #date=`date -j +”%Y-%m-%d %H:%M:%S` #echo “<tr><td align=center>Temperature for $date</td></tr></table></div>” >> /usr/local/www/temp/index.html tmp1=`cat /tmp/temp.tmp` flag=`expr $S0 – $tmp1` echo $S0 > /tmp/temp.tmp # Prepare a mail echo “To: admin@domain.com” > mail.txt echo “From: admin@domain.com” >> mail.txt echo “Subject: Server room = $S0” >> […]

Previous Posts Next posts