Some tips for me and other


CentOS + tmpfs

I saw this in a report: /etc/cron.daily/ 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/ & Run without user session: nohup & or nohup > /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 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:” > mail.txt echo “From:” >> mail.txt echo “Subject: Server room = $S0” >> […]

Windows 2012 Terminal Services + Thinstation + cursor issue

I have a Windows Server 2012 and users connect to it via RDP. They have thin clients Wyse 3150 with ADM Geode. If they use built client they get artifacts on a screen after 5-10 min. If they use Linux client from PXE (Thinstation 2.2.2i) they have issues with a cursor – it disappears suddenly […]

Previous Posts Next posts