You might get a warning unknown file system type ‘ntfs’ when trying to mount an NTFS disk on a CentOS server.

EPEL Repositories

To overcome this issue, you need the epel repositories enabled. If you haven’t done this before, just get the epel rpm file from the websites below and import them using rpm.
Note that the rpm files are different for CentOS 5 and CentOS 6.

We needed a simple way to backup our network settings on a Cisco device at Veriteknik, so I decided to write a script.

You can simple connect to the device via telnet, declaring your username and password. For security reasons, we use IP address restricting as well.

So, it is quite easy to send and recieve telnet commands in Python, simply use the telnetlib library.

Getting the settings of a Cisco device is quite easy, simply enter the “sh run” command and the output is your settings. But normally the device will output the settings in bits and pieces, using a “more” like function. This is set on the terminal length parameter. To check it, simple use the following command on your device,

To set this value to 0, which means you’ll get the full output instantly,

terminal length 0

This command will change the option, but that is only for the current session. When you relog to the device, the value will be set to default, which is a good thing cause we want only our Python-Telnet session to get a non-more-like terminal mode. You can read about this on Cisco’s documentation here.

Now using the script below, we can simple get our backups. This script is for Python 2.x, it won’t be that different if you want to use it with 3.x either.

I’ve written a backup script in order to get my WordPress blog backup automatically. The script is only usable on a Linux/Unix box, since it uses default GNU tools.

The script connects to the server via ssh, copies a folder to a location, dumps a database to the same place with the copied folder, creates a tar.gz out of it, then gets the new file via ftp to a prefered location.

The important thing here is that, you should add your ssh public key to the server so that ssh will connect automatically. I also use .my.cnf files to login mysql without specifying password, so you’d better do that. I’ve talked about it in an earlier post here.

Keep in mind that you need an ftp client to connect. If you don’t have it, install it using yum, apt or whatever.

Or, just run the script whenever you want. I usually set the download path (defined as the $DROPBOX variable on line 16) to my Dropbox folder, this way my backups get automatically synced on the Dropbox server.