HOSTED SCRIPTS SECTION

 

This section will be hosting scripts that have been found to be usefull, but don't have a home where to be hosted. Feel free to contact me, if you would like to post some work of your own.

Rsync Auto-Backup To Usb

If you need to make backups to usb devices periodically, you can download and use this bash script to automatize the process. All you need is rsync installed. The script will look for the specified device and try to mount it. If successfull, it will execute rsync jobs. Make sure
that the script is executable, and change the following variables to suite your environment:

### CONFIG VARS ####################################
LOCK_FILE="/tmp/rsync-usb.pid"		# the lock file name
MOUNT_DEV="/dev/sdh1"			# mount device
MOUNT_PATH="/mnt/autobackup-usb"	# mount point
BACKUP_DIR="/home/*"			# backup directory
RSYNC_LOG_FILE="/var/log/rsync/usb_backup.log"# rsync log file
################################################
				
To execute the script, you can either call it from a shell or run it as a cronjob.

Mysql Auto-Backup Script

This bash script is quite usefull if you need to make a backup of your mysql databases. The script supports rotation, which means that older files of a given number of days will be deleted. You can download the script from here and read the header for options and configuration.

Jquery Toggle Class

This javascript class, is usefull to hide/show html elements with the help of jquery toggle function. The code is portable which makes it very easy to implement in any environment, all you will need is jquery installed. To get started using this tool, download the class, upload it to your ftp and follow the examples below for correct usage.

var cls=new smartToggle();
# onclick toggle example
onclick="cls.toggle('html_el_id',100);return false;"
# onclick slide toggle example with change link text
var el_id='html_el_id';
var link_id='link_el_id';
var link_text='new link text';
onclick="cls.slidetoggle(el_id,100,'regular',link_id,link_text);return false;"
# onclick expand multitoggle to show/hide multiple elements with 1 click
var el_show_ids=['el_show_id1','el_show_id2'];	# literal array
var el_hide_ids=['el_hide_id1','el_hide_id2'];		# literal array
onclick="cls.multiToggle(el_show_ids,el_hide_ids,1200);return false;"
					
All examples use onclick listener, but you can call the methods of the class however you wish.

⇑Back to Top⇑