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

Tomato Router Config – Backup Script

Posted: March 18th, 2011 | Author: | Filed under: Linux, Tech | Tags: , , , , , , , , , , | 2 Comments »

I recently was given the task to automate the backups of several remote routers that we manage that run tomato firmware.
Here is the Tomato developer’s site: www.polarcloud.com/tomato
The main goals were:

  • To use https
  • To be automated (Cron)’d later
  • To scale from 1 to 1XXX routers

I tested it on Tomato Firmware 1.28 using my ASUS RT-N16 router, but it should work for any Tomato-firmware router.
There will be some slight modifications to run in cron, but let me know and I’ll be glad to help.
Download the .zip file here: tomatobackup1405

Extract the file so the full path will be /root/tomatobackup1405
Read the README inside the folder
chmod +x tomatobackup1405.sh
Add your hosts to the tomatobackup1405_hosts.cfg file
Run it!

If successful, you will see a subfolder with the date YYYYMMDD and the file with CoName-tomato_v_.cfg
If there are connection problems, you’ll see an error message.

EDIT: There was a python rewrite by Sam@orgraphone.org
Feel free to check it out here

Let me know if you have any thoughts or suggestions.
-Gregg


1 Keyboard, 1 Mouse, Multiple Computers

Posted: July 22nd, 2008 | Author: | Filed under: Linux, Mac, Tech | Tags: , , , , , , , , , | 1 Comment »

Most tech-folk know that desktop real-estate is key to optimizing efficiency. Adding a second monitor can increase your work output/efficiency by almost half. So if you are like most people and have a desktop and a laptop, get ready for the best FREE upgrade you can make to your setup.
This article is also for those of you who are using multiple keyboards/mice on your desk for more than one computer. The solution to this cumbersome setup is Synergy. Synergy works by first defining where the computer screens are arranged (macbook to left of desktop, desktop to right of macbook…etc). The program can act as a client or host. The main computer with the keyboard and mouse is the host. The client computers consist of every other computer you want to use. I currently have a desktop as my host with 4 LCDs. To the right I have a mac mini on a 19″ LCD, to the left of the desktop is a macbook, to the left of the macbook is another laptop. I can control all of these with one keyboard and mouse seamlessly dragging from monitor to monitor. Synergy works by sending all of the mouse information over the local network to each defined host. It’s worth noting that the clipboard carries over too! From Mac, to Linux, to Windows!

What you need:
1. For mac users the gui wrapper for synergy is fantastic. Get it here – SynergyKM.
2. For *NUX and Windows users, get it here – synergy2.sourceforge.net

By the way, Synergy is open source (most things on this site are).

Here is a great example of synergy freeing up desk space:


Flip1405 – The Failover Asterisk Solution

Posted: July 12th, 2008 | Author: | Filed under: Asterisk VoIP, Linux, Mac, Tech | Tags: , , , , , , , , , , , , , , , , , , | 57 Comments »

Flip1405 is an Asterisk Failover solution that was created in early 2008. I found the need to create an easy to install failover solution for Asterisk servers. After a couple hours on a Sunday night, I had the first version completed. In 2009 someone who came across this script reworked the code to add new features, and I updated the site. Now, in 2011 I am glad to announce that there is a new version that has many new features and improvements over my existing code. Many thanks to Jonathan Bayer for updating the script again. His site is http://linuxnotes.us

Excerpt taken from his site:
Congratulations! You have now set up your first Asterisk-based VOIP server.

Next question (probably the first your boss will ask you): What happens when the server crashes, or loses power, or needs to be upgraded, or…….; well, you get the idea. If you only have a single server, you lose your phones until it is rebooted. Given that you probably installed this on a cheap, inexpensive piece of hardware, these questions are not out of the question, especially for a business.

We had the same questions, and have implemented a failover solution. I started with a script I got from this web page, but was dissatisfied with it. It seemed to be a bit of a kludge, in that it wasn’t a true HA solution, but was only a backup solution.

I did a massive reworking of the script, and the result downloadable from here:

flip1405.sh

This script is used to synchronize the /tftpboot with the /var/ftp/ directory:

syncftp.sh

The only dependencies for Flip1405.sh are nmap and arping

To use, first get your primary Asterisk server running smoothly. When ready, you can either clone it using Clonezilla (or some other utility) or just install Asterisk on the second box. Then follow these steps:

Setup shared-keys so the servers can copy between each other without user intervention. Setup Login without password
Set up ftp (I use vsftp), if needed. We use it to download the configurations for the Aastra phones. Usually we would use tftp, but since we have some phones outside our office we simply use ftp for everything.
Install this script into /usr/local/sbin on the primary/active system.
Run the script with the -s option:
/usr/local/sbin/flip1405.sh -s
The second script: syncftp.sh, is used to synchronize the /tftpboot directory with the /var/ftp directory. If you need it, install the syncftp.sh script into /usr/local/sbin
Open up the flip1405.sh in an editor, and check the various settings. I would recommend that if you need to change them, to use a config file (/etc/sysconfig/flip1405) rather than editing each file. The config file is NOT sync’d between the systems, so you can have system specific options in the file.
There is no need to specify the device, or whether the system is a master or slave. The script determines this at run time. The most important lines to set are the first three variables: MASTERIP, SLAVEIP, and FLOAT. These are:
MASTERIP IP address of the master system (arbitrary name)
SLAVEIP IP address of the slave system
FLOAT IP address that will float between the Master and Slave, and which your phones will access
All other variables are set for an Elastix system. Elastix is based on the following:
Asterisk 1.6
Centos 5.5
FreePBX 2.6
Make sure to set the bindaddr to the virtual IP address in /etc/asterisk/sip.conf or
/etc/asterisk/sip_general_custom.conf
bindaddr=192.168.1.12 ;IP of Virtual interface
Add the following line(s) to the root crontab (only install the syncftp.sh line if you are using it):
* * * * * /usr/local/sbin/flip1405.sh
*/5 * * * * /usr/local/sbin/syncftp.sh
If you like, you can add the following lines to /etc/crontab instead:

* * * * * root /usr/local/sbin/flip1405.sh
*/5 * * * * root /usr/local/sbin/syncftp.sh
If you have phones outside your network, you will need to configure your firewall to direct the following ports to the FLOAT address:

tcp 21 (if you are using ftp)
tcp 3000
udp 3000
tcp 5060-5082
tcp 10000-20000
tcp 5800-5900
udp 5060-5082
udp 1000-20000
udp 5800-5900

Click below to see previous versions (20090327)
Old Versions