November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Mysql backup using samba

#!/bin/bash # This script creates a copy of the /opt/zimbra folder and then compress # it localy before sending it over the nework so make sure there is enough space # left on your local hard drive ($parentfold variable). # A samba share is used in this script, fill the ## NETWORKING ## section # […]

Bash Profile Tips

If you’ve been learning the command-line and you have the basics down (you should be, as the most effective way to use a computer is a combination of a GUI and command-line), the next step is to customize your environment.

Beginner’s Tip: “command-line” and “shell” are often used synonymously. In unix, technically speaking, the shell […]

List last modified – shell Script

SHORT_HOSTNAME=`hostname -s` LOCATION=”/home” # DESTINATION=”$1″ if [ -z “$1″ ] then DESTINATION=”$LOCATION” fi # EMAIL_TO=”test@rmohan.com” EMAIL_SUBJECT=”List Last Modified files from $SHORT_HOSTNAME” EMAIL_BODY_Line1=”Below is the list of last modified files:” # MOD_FILES=`find $DESTINATION -type f -mmin -10 -ls` # if [ -n “$MOD_FILES” ] then printf “$EMAIL_BODY_Line1\n\n$MOD_FILES\n” | mail -s “$EMAIL_SUBJECT” $EMAIL_TO fi # […]

Elapsed Time for Shell Scripts

lot of times you want to calculate the time it takes for a part of a shell script to run. Here is one of the ways you can do this:

T1=$(date +%s) # Do something here T2=$(date +%s) diffsec=”$(expr $T2 – $T1)” echo | awk -v D=$diffsec ‘{printf “Elapsed time: %02d:%02d:%02d\n”,D/(60*60),D%(60*60)/60,D%60}’

This will tell you […]