FreeBSD: Monitor svn Updates

If you use the  svn subversion tool to update source tree or ports tree, you want to have a possibility to look back what was pulled, pushed and droped you can use a Log File to monitor the update scripts. This helps if you temporarily log out the Terminal Sessions for a Coffee break.

Howto:

  • Login to FreeBSD via SSH
  • Use a tmux program like screen or tmux, if not installed, then install it. This allows ongoing operations on disconnects
  • Run on the Terminal
    $tmux
  • Run
     $sudo svn update /usr/src > /home/updates/svn.log #exit STRG+B then press "d" detach
    
  • The svn script goes on at background and write the output to the svn.log
  • To read at realtime the log do
    $tail -f /home/updates/svn.log #remark this allow no interaction!
  • Later you can read the Log again to view what files were, dropped, updated, created. This helps to find MAJOR CHANGES!

WordPress: Monitor the Size of the MYSQL Database

If you use WordPress or a other Blog Software with a MySQL Database over years it is useful to do some things regularly:

  • Check the Database Size weekly, that no Skript Kid has found a Backdoor and fills up the Database silent
  • Purge Database Caches with default maintenance tools of the Software
  • Dont forget to create a MySQL Dump Backup weekly with cron

To Check the Size login on mysql command prompt do:

$mysql -u dbuser -p #Enter Password

mysql > use dbwordpress

mysql > SELECT table_schema "Data Base Name", sum( data_length + index_length) / 1024 / 1024 
"Data Base Size in MB" FROM information_schema.TABLES GROUP BY table_schema;

System Echo a Table of all of your Databases with size!

If the size is much more bigger than last week and you haven’t changed anything you can try to cleanup the Database by for example with a upgrade.php, update.php or other commandline PHP Scripts of the PHP Kit (WordPress, Drupal..) Maintenance Tools. Often many little things are cached into the MySQL Databases. If this doesn’t help, rewind to older MySQL Dump and test again. Don’t forget to keep the old WordPress-DB and rewinded WordPress-DB MySQL Dump secure! If the Database grows again fast, login to WordPress, check comments area of the posts sites. If comments are allowed by Guests, disable them to prevent Spammers.

Raspberry Pi: Howto build a Local Network Monitor for Intrusion Logging Watchdog

Today the count of network devices at home networks grows up weekly, cause more and more home devices like freezers, coffee engines, dishwasher and more got builtin wifi interfaces. To have a Control Unit you can use a raspberry pi2 as cheap Network Monitor Logger.

The Raspian by default offers builtin free tools, like arp, arp-scan, nmap, ping to easy monitor a network. If you have learned some commands and the bash scripting you can fast create a Network Logger, perhaps with analyse tools to mail alerts if new „MAC“ NIC Adresses are seen. Every network device uses a owned MAC-ID like „00:d0:23:09:df:XX“. Thats like a car chassis number.

 

arp-scan
arp-scan

How to Setup:

  1. Install Raspian (Debian) on a SDCARD for PI2
  2. Boot the PI2 to Raspian
  3. Upgrade the OS
  4. Install lighttpd as Webserver for Outputs and start him
  5. Install the  Networktools „arp, arp-scan, nmap, ping“
  6. Edit root crontab to run the commands every minute like „* * * * *  /usr/sbin/arp-scan -l -I eth0 > /var/www/arp1/2-scan.log“
  7. Open a webbrowser to http://pi2/arp-scan.log #You should see the Text like inside the Image
  8. write a bash script with the „diff“ or „md5sums“ command to check the arp1-scan.log against the arp2-scan.log if any changes you can output a mail thru exim4 mailserver..

Advantage? A Pi2 is a powerful LAN WATCHDOG with 1Watt/hour and Mail Output Support to your devices! for free..