Using rsync with CIFS or SMB (Windows) Destination
26 11 2011Categories : Linux Luvin'
Trackbacks : No Trackbacks »
If you're an Ubuntu fan like me and use (or want to use) OpenVZ, you might not be too excited that the OpenVZ site doesn't yet have the latest edition of Ubuntu, 9.10 Karmic Koala, available as a precreated template. Luckily, you can find them here.
For my purposes, I downloaded ubuntu-9.10-minimal_9.10_amd64.tar.gz. After setting up a virtual instance with Proxmox and opening up a VNC session, I found that this template is way more minimal than I ever expected. In all reality, that isn't so bad. The lighter, the better. Unfortunately, since I was setting up this new instance as a server, I had a good bit of work ahead of me.
Firstly, networking wasn't working at all with my bridged setup out of the box. The solution:
edit /etc/network/interfaces and configure your NICs. I had to comment out some properties of the venet0 interface to get things working. Here's my final config file:
Notice that I'm using a static IP address. You may want to try DHCP starting out since it'll make things easier. Confirm network connectivity by pinging a remote host. Don't forget to edit /etc/resolv.conf if you need to.
Now, I need to get some goodies installed on this thing. In the end, I'm looking to install Virtualmin and host some websites, so I need to prep for that. Luckily, Ubuntu makes it easy to get things started quickly. Start off by issuing:
An ncurses dialog should appear. Go ahead and select what you need. I can tell you that I learned the very hard way by not initially selecting "Basic Ubuntu Server." If you don't select that (don't worry, it's only a couple of small packages), none of your services will start at boot-time and you'll have to start each of them manually.
From there, you should be on your way. I strongly recommend Webmin (add the apt repo) to ease server administration tasks.
Also, before I leave you be, if you're not using Proxmox to perform all of this OpenVZ magic, you're definitely missing out. Hurry up and convert already!
According to the Virtualmin website, the latest version of Ubuntu that is supported is 8.04 LTS. That's probably a safe stance to take since non-LTS versions of Ubuntu have a six-month lifecycle, and most serious hosting companies would stick with LTS versions. For those of us who live on the bleeding edge and want to try Virtualmin on the latest version of Ubuntu, 9.10 (Karmic Koala), you'll find that the standard method of installation (the install.sh script on their site) will fail.
Luckily, the solution is simple.
Add the following repository to your sources.list file:
Then run the following as root:
Webmin and Virtualmin will now be installed. Note that the repository may not be as up-to-date as the direct download link. If that scenario arises, simply find the URL of the latest Virtualmin package from the link, and do:
This is a script I wrote a while back but never posted up. It allows you to switch from one gateway to another by repeatedly pinging your ISP gateway (or another external IP) and--upon detection of failure--switching to another gateway. If the primary line is up upon the next run, we switch over to it.
This isn't a very advanced script and doesn't factor in other considerations, such as the state of the physical interfaces. It simply attempts a number of pings, and considers the link dead or unreliable if they don't all come back.
If you have mutt installed, you will get an email alert when the primary link is considered 'dead.' You can easily change this behavior by modifying the script.
It will probably work on other POSIX/Unix-like OSes, but I've only tested it on Linux in a BASH environment. With all that said, here are the goods:
Download it here.
This script was written for the company I work for well over a year ago, but I just decided to release it to the public now. It has been in use all of this time and is still in use now, so that should tell you that it's a pretty reliable script. Any bugs we encountered over the course of using this program have been fixed. Hopefully you'll have the same luck as us.
Basics:
This script is run as a SVN hook (post-commit). After committing changes to your subversion repository, this script is invoked and synchronization begins. The script creates a local copy of the repository, and files just committed are sent via FTP.
Usage:
One copy of the script can be used for an unlimited number of repositories, so the script can be placed in a globally-available location. In our scenario, we placed the script at /usr/local/bin/svn2ftp.sh . There are four command-line arguments to the script that are required. The first two arguments can be kept the same as below, as they're passed to the script by subversion. The third parameter is the path between the repository and the trunk (e.g., if your SVN path is http://<host>/svn/repo/dir/trunk, then you'd put "dir" as the parameter; otherwise, you'd put "." if there's no directory in between). The fourth parameter is the full path to the config file of the repo. A sample to put in repo/hooks/post-commit:
We have our directory structure as follows, but you can change it as you please:
/svn2ftp/conf # Where config files are stored
/svn2ftp/logs # Where log files are stored
/svn2ftp/repos # Where raw repo contents are stored
A sample config file can be found below.The code:
I initially wrote this program using the Linux 'ftp' program. It works well and all, but if I encounter server or any other errors, the program still exits with a successful error code. This was a bummer in our situation, so I wrote an FTP client in PHP that reports errors correctly. When an error is encountered, files that were not uploaded successfully will be retried upon the next commit. Links to both versions, as well as the config file, are below:
A good filehost is important for use in many different applications. It can help you to share large files with friends and colleagues, and can really be useful in more life-saving applications, such as backups. I use these services to accomplish both, although I do admit I rely on them heavily in parallel with my backup scripts; I get a nightly backup of each of my MySQL databases to multiple email accounts, as well as to FTP. I know it's super-redundant to happen this way, but I learned my lesson from the past. Plus, this level of redundancy is pretty nice. Here is a list of some of the file hosts that I use, and will update the table later with more details.
| Name | Filesize Limit | Download Speed | Upload Speed | Comments |
| www.oxyshare.com | 700Mb | ? | ? | Used to be my favorite file host until things started going wrong. |
| www.up-file.com | 2GB | ? | ? | ? |
| www.mediafire.com | 100MB | ? | ? | ? |
| www.gigasize.com | ? | ? | ? | ? |
| www.mihd.net | 1GB | ? | ? | ? |
| www.files-upload.com | 1GB | ? | ? | ? |