Linux Quick backup of current folder

Sometimes you just need a fast backup of the current folder...

To adapt to Godaddy shared hosting SSH access, remove the sudo from the tar command.

# Simple bash script to compress the current folder structure into a
# tar.gz file in a backup folder under the current user home folder.

# Tested on various linux systems.

# Sets the date variable format for zipped file: MM-dd-yy_hh_mm
NOWDATE=`date +%Y-%m-%d_%H%M`


Sometimes you just need to wait...

@echo off
rem #
rem # Written by Ian Willis 2010-10-10
REM Launch an application ONLY if we can ping an address.
REM Loop until we do ping.

set shortcut=c:\Notepad.lnk

ping %server%
if %errorlevel%==1 (
Echo "Ping failed."

if %errorlevel%==0 (
msg %USERNAME% "Ping succeded, Application %shortcut% will start now."
start %shortcut%
goto exit


Find folder sizes on Ubuntu


I needed to find out the amount of data stored in a group of folders. Each of the folders contains a web site, and I want to track the sites on-disk usage statistics.


Linux system running bash.

du binary (typically induced in linux base install or busybox.

Tested on Ubuntu 12.


du -shc *

s ..... Summary
h ..... Human Readable. K, M, and G for sizes.
c ..... Summary or Total
* ..... All files or folders in the current directory.

Add SWAP disk on Amazon EC2 Ubuntu servers


My Ubuntu web servers were killing processes due to low free memory. I would prefer them to slow down than to kill processes. So I added SWAP disk space that is not setup by default in the EC2 instances.


Amazon AWS EC2 Ubuntu 11 or 12 instance.

This may work on other Linux versions, but I have only used it on Ubuntu.

Removing old JAVA installs


First off, has a Java applet to do this very thing.

However, if you need to run this on many computers using a login script, or patch management system, here is my alternative.
It may not be complete, but it removes several versions of java using the command line uninstall method and a little brute force execution.

Batch Move files


I needed to move files in batches that would put no more than 600 files in a folder at any time. I wrote the batch file to count the files in the target directory,


Tested on Windows 2008 R2.

Command line should be compatible with Windows 2000 or newer.

Backup Shell Script for Linux Web Host


Backup multiple web sites stored on a Linux server. Sites are stored in a single folder as sub-folders.

I run a web host that is a custom fault tolerant solution on Amazon AWS t1.micro hosts. The primary host should be backed up daily, but a historic backup was necessarily. My goal was to have two weeks of daily backups. The sites databases are backed up separately, so my primary concern was the folder contents.

Clone multiple virtual machines to a different datastore as a backup


Clone multiple virtual machines to a different datastore as a backup.

All of my virtual servers, and ONLY virtual servers in a specific folder in vcenter, needed to be cloned to a backup datastore weekly, so I wrote a powershell script to clone them. I then added a Scheduled Task on my vCenter server to execute the script on Saturday evening.

Reboot Virtual Machines by name wildcard


Reboot multiple Virtual Machines on a single vCenter server based on a name with a wildcard.

All of my Virtual Desktops, and ONLY virtual desktops are prefixed by the characters vm- or vm7-, so I wrote a powershell script to reboot these. I then added a Scheduled Task on my vCenter server to execute the script.