Social security for getting on a large amount Beat The Cycle Of Debt Beat The Cycle Of Debt for an approved in addition questions.

Safe1405 – Automated or Interactive Asterisk backup solution -with auto FTP upload

Posted: April 27th, 2009 | Author: | Filed under: Asterisk VoIP, Linux, Tech, Uncategorized | Tags: , , , , , , , , , , , , , , , , , , , , , , , , , | 6 Comments »

Summary:

Safe1405 is a bash script that will backup the popular Asterisk directories and place them in a tar.gz file. The script can be used in 1 of 2 modes.
The first mode is interactive, with a menu to choose:

  • Backup Everything (/etc/asterisk, Voicemail, Recordings, Sounds)
  • Just VM
  • Just Recordings
  • Just Sounds

After the file is created, it will prompt to upload to a remote FTP server.

The second mode is silent, and is best suited for automated execution via cron or at.
Just enable the UNATTENDED and PUT_FTP variables by setting them to “1″.  You can directly edit the paths to each directory if yours are non-standard.

The script can be directly downloaded here: Safe1405 Download Link

Code:

#!/bin/bash
# Safe1405
# Author: Gregg Hansen - www.thiscoolsite.com
# Safely tar and gzip Asterisk files

# Version 1.0 20090427
#-Backs up all important Asterisk files - Tar/Gz
#-Choose the file name, or Date by default
#-GUI-like. Able to be silent for cron, or interactive

#EDIT the below ABSOLUTE paths to match your directory structure:
VAR_LIB="/var/lib/asterisk"
ETC_AST="/etc/asterisk"
VM="/var/spool/asterisk/voicemail"
MON="/var/spool/asterisk/monitor"

#Date Var
FILEDATE="$(date +%Y%m%d)"
#Your ServerName
#Filename is FILEDATE-SERVERNAME.tar.gz
SERVERNAME="Chicago-Ast01"

#Enable unattended mode/Remote FTP put (useful for Cron):
# Backup of /etc/asterisk ONLY (default)
# 1 = On, 0 = Off
UNATTENDED="0"
PUT_FTP="0"

#FTP Credentials
FTP_IP="127.0.0.1"
FTP_USER="admin"
FTP_PASS="secret"

###--START CODE---###

### Interactive Mode Functions ###
prompt()
{
cat <<EOF

Safe1405 Backup

1) Everything
2) /etc/asterisk
3) Voicemail
4) Recordings
5) Sounds
Q) Quit

EOF

echo -n "Prompt> "
read INPUT
case $INPUT in
1) everything;;
2) etc-ast;;
3) vm;;
4) recordings;;
5) sounds;;
q) exit;;
Q) exit;;
esac

}
everything()
{
FILENAME="$FILEDATE-$SERVERNAME-FULL.tar.gz"
tar cfvz $FILENAME $ETC_AST $VM $MON $VAR_LIB
ftpprompt
}
etc-ast()
{
FILENAME="$FILEDATE-$SERVERNAME-ETC_AST.tar.gz"
tar cfvz $FILENAME $ETC_AST
ftpprompt
}
vm()
{
FILENAME="$FILEDATE-$SERVERNAME-VM.tar.gz"
tar cfvz $FILENAME $VM
ftpprompt
}
recordings()
{
FILENAME="$FILEDATE-$SERVERNAME-REC.tar.gz"
tar cfvz $FILENAME $MON
ftpprompt
}
sounds()
{
FILENAME="$FILEDATE-$SERVERNAME-SOUNDS.tar.gz"
tar cfvz $FILENAME $VAR_LIB
ftpprompt
}
ftpprompt()
{
echo -en "Upload $FILENAME to FTP? (y or n) "
read INPUT
if [ "$INPUT" == "y" ]; then
quietftp
fi
}

### Unattended Mode Functions ###
silent()
{
tar cfvz $FILEDATE-$SERVERNAME-ETC-AST.tar.gz $ETC_AST ##Uncomment##$VM #$MON #$VAR_LIB
FILENAME="$FILEDATE-$SERVERNAME-ETC-AST.tar.gz"
}

quietftp()
{
ftp -ivn <<EOF
open $FTP_IP

user $FTP_USER $FTP_PASS
binary
put $FILENAME
bye
EOF
}
#### Start Program Flow ###
clear
#Unattended Function Call(s)
if [ "$UNATTENDED" == "1" ]; then
silent
if [ "$PUT_FTP" == "1" ]; then
quietftp
exit
fi
exit
fi
#Interactive Function Calls
prompt
exit

###–END CODE—###
Leave a comment if you have questions/suggestions or would like help setting up the script.
-Gregg


SourceCode: QuickKey Portable for Windows

Posted: April 17th, 2009 | Author: | Filed under: Tech | Tags: , , | No Comments »

Summary:

“QuickKey” is an application I created with AutoIt to take text from the clipboard and save it to a hot-key combo. I needed it to do repetitive form filling. It’s written to be lean, quick and dirty. Here are the usage instructions:

  1. When launched for the first time, it creates and populates the “Clips” directory with it’s required files.
  2. The hotkeys to save text from the clipboard are all “CTRL” + “SHIFT” + any number key or function key from the top 2 rows of your keyboard (total of 22 available saved clips).
  3. The hotkeys to use a saved clip is simply “CTRL” + the number or function key you used when saving that clip.
  4. Example: “CTRL” + “SHIFT” + “6″ saves text from the clipboard to the 6.txt file. “CTRL” + “6″ sends the contents of the 6.txt file. Its like pasting it, but its more like automated typing.

Source Code:

Read the rest of this entry »