After my Raspberry PI died, I decided not to get a new one immediately. Instead, I turned the older laptop into a FreeBSD server. I use this server for Git, backup via ZFS snapshots, running Debian/RHEL VM using bhyve, side project web server and jails with ZFS. It works perfectly, but during monsoon season, the electric supply at home goes for hours, and my battery backup UPS only works for 15 minutes. Hence, when my FreeBSD laptop starts to run out of battery juicy, I want to shut it down automatically to avoid sudden filesystem and other corruption issues.
[continue reading…]

Here is a handy and useful Linux and Unix shell script that reduce PDF file size using Ghostscript. No need to upload your PDF file to the shady third-party website. Just do it from the terminal. I tested it with both CentOS and Ubuntu/Debian Linux.
[continue reading…]

A shell script mirror remote server named and /backups directory to another server. The script use rsync command and also make sure a special directory mounted in local server. You must setup ssh keys (see “How To Set Up SSH Keys” for more info).

# Purpose: Mirror remote server backup using rsync command
# Author: Vivek Gite {}
# License: GPL ver 2.x+
# Note: Tested on Debian/Ubuntu and CentOS only.
# ------------------------------------------------------------
## change me ##
# Make sure offsite backup directory mounted
mount | grep -q ${_mnt}
if [ $? -eq 0 ]
  # Make dir if not found
  [ ! -d "$_dest" ] && mkdir -p "${_dest}"
  # alright mirror it. make sure you setup ssh-keys
  rsync --bwlimit 10000 --delete  -P -az -H --numeric-ids ${_user}@{_host}:${_dir} ${_dest}
  echo "$0: Error '${_dest}' not mounted." 
  exit 999