Server Guide and Blog

Rock Your Linux

By

Stdout or a Pipe and a Tee

If you have a binary that is outputting information to standard output, you can save the information 2 ways. You can direct the output to a file using >> or you can use a pipe with a tee. When you use >> you will not see the output, it will directly get dumped into the file, which is why the pipe and the tee is useful. Lets say you want to monitor your your mail.log. Open it with tail -f, and watch it on the screen:

sudo tail -f /var/log/mail.log

I find it interesting sometimes to watch spam and viruses get processed by the server.

Now if you want to save this output to a file other than the default mail.log you can direct the stdout to a file using >>:

sudo tail -f /var/log/mail.log >> ~/mail_bak.log

If you want to view the tail, while you are also saving it to a backup log file, use:

sudo tail -f /var/log/mail.log | tee ~/mail_bak.log

Two options, I use them both on occasion.

By

Cable Internet – Isolate the Problem

Motorola SB5120 Modem

Image via Wikipedia

After rewiring my entire house the ultimate way to isolate the problem is to put the cable modem directly on the main line. Replace all splitters, and ask the cable company to drop a new main line, and you can feel confident that the problem is no longer in your house. I rewired my entire house, replaced all splitter, then called the cable company. They replaced the splitter outside, and then dropped a new main line. The problem is no longer in my house. My router is loosing its external ip address. So far the cable company said they will compensate us for one months service, if this continues more compensation is warranted.

Every time the internet goes down, this website, my other websites, and all of my email services go offline. I rely on this website to get me through the day when I am at work. What is a day of work when you can blog about things :)

Reblog this post [with Zemanta]

By

Slave Server – Backup the Backup – More Uptime

I’m almost at the point of having a completely duplicated slave server. Currently mysql database replication is working. I have apache php5 and mysql fully working. The server synchronizes the apache root directory, with the server, every minute. Therefore for all practical purposes any file changes on the master are propogated to the slave. The mysql database is propogated in real time. I installed dovecot, sendmail, spamassassin, and clamav therefore the email environment is setup. I’m going to sync the entire /etc directory.

I’m stuck, for a little, on the users inboxes. I’m trying to rsync /var/mail but I think some permissions are missing. After I get the /var/mail directory to synchronize, as per crontab, the systems will be fully synchronized.

Now when server2 is backed up using vboxtool the main server will remain completely online! This will save approximately 5 minutes per day, therefore I will be saving 30.42 hours of downtime per year. By backing up the server as such I will be adding 30.42 hours of uptime; a rather big number.

By

Thunderbird – Built in Spamassasin

ThunderbirdUsing Thunderbird, in conjunction with your IMAP configured dovecot is by far the best method of synchronizing you mail folder with multiple devices. In Thunderbird you should instantly turn on your junk mail “adaptive filters”. You can also set custom filter rules to send messages with particular words in the header to the junk folder. Frankly I prefer using the graphical configuration of Thunderbird to the direct command line configuration of spamassasin. Thunderbird is powerful, and successfully filters out well over 95% of the spam I receive. I get closer and closer every day to completely avoiding all spam. Every day I set a new filter rule, and mark new messages as spam.

By

I Love Virtualization

Virtualization is simply the coolest. I currently have 4 linux servers running. I consolidate my mail server in my web server, which takes one virtual machine. Another virtual machine is running a file server. The third is running a VPN for my iPhone. And the last server is running Nagios to monitor the uptime of all my servers. In addition I am concurrently running Windows XP for a program that graphically monitors the visitors to my websites. In the end I am only consuming about 1.5 Gigabytes of ram after all the virtual machines have fully loaded. I can have many many many more virtual machines, given that I have 5 Gigabytes of ram on my PC. This is power. Virtualization is power. The potential is incredible. Not to mention I have 3 hard drives in raid1 to ensure system stability in the case of hardware failure. I am going to set up the following: I want a 4′th hard drive, which I am going to connect via an external SATA port. They call these ports ESATA, which could have been seen a mile away. I am still debating weather to sync the drive via raid, or via rsync. A raid sync will be seamless, whereas rsync will probably consume some computing power. Also if something happens to the software on my PC the raid will copy the corruptions to the backup drive. Using rsync manually would most likely avoid copying corrupted data.