Archive for the 'System Administration' Category

Quick SSH Tip

I'd wager many of you know this already. Having done this a couple times the last two days though, I thought I'd add it for those that don't. Maybe it's useful to someone.

Problem: You want to log into a remote server with SSH and you don't want to type a password. You know about key pairs and authorized_keys and are ready to copy your public key. You might be tempted to do it like this:

  1. SCP your identity to the remote machine (have to type your password again).
  2. ssh to the remote server (have to type your password again)
  3. append the public id to the authorized keys file
  4. delete the copied file
  5. Exit
  6. try the keyless login

Here is where you can save a few steps. You can append the file with ssh instead of copying the file over with scp. This saves you a login and typing your password once.

  1.  
  2. cat id_dsa.pub | ssh remote_server "cat >> [path to user home]/.ssh/authorized_keys[2]"
  3.  

There. Type your password once for the copy and then test the passwordless login.

Microsoft exchange hosting with Sharepoint

I'm a Linux advocate myself. My servers run Linux. I use Linux primarily for my work. At home, I either use Linux or my iMac. While I can get all the services I'm happy with, I have to realize that some people like services that are harder to find and host with Linux. I've come across my second situation recently where someone wanted a hosted exchange server. Some might advocate attempting a non-Microsoft work alike for this but I find there comes a point when it's more work than it's worth. This is especially true when you can set up a service like Sharepoint hosting for as little as $8.95 per month.

SherWeb provides a complete package with their Microsoft Sharepoint hosting. In addition to email, you can set up calendars, contact lists, tasks, alerts, rss feeds and a few other things. The rss feeds, for instance, can be connected to any of the Sharepoint features. You can create an rss feed for a contact list or calendar, and then allow certain users access to that rss feed. There is also a way to work on office documents with the document workspace hosted and shared. Another exciting feature for many business users, is the option to connect to, modify, and and new content with a mobile device.

All of these features are sharable with an unlimited number of users. You can add unlimited users to your system no matter which data plan you choose. Furthermore, all the features of Sharepoint are included with every data plan. The more expensive plans simply allow you more disk space. You can relatively cheaply try out all the benefits and then spend more as you grow.

Upgrading to WordPress 2.7

I just updated all my blogs to WordPress 2.7. I like the new admin interface. The upgrade was pleasantly easy and quick.

Virtual Hosting TurboGears Applications on Mac OS X Leopard

For a couple years now, I've been learning and applying various tricks for developing and hosting multiple Python web sites on my development machines. During that time, I made a migration to Mac OS X. Most setup files for python applications and libraries work out of the box on the Linux distributions I've tried. For OS X, you can find a lot of prebuilt packages for the necessary dependencies but those packages want to be installed in the OS X system library location for Python.

If you want to host or develop more than one site with Python, you'll need to use virtual environments. This applies equally to any OS, not just Mac OS X. There seem to be a few more tricks to getting things up and running on OS X however. Here is the process I went through to get TurboGears applications hosted in virtual environments on OS X.

Continue reading 'Virtual Hosting TurboGears Applications on Mac OS X Leopard'

Linux-Vserver vs Xen

A while back, I found myself running out of hardware and wanting to host more sites than I currently was. In addition, I wanted to create a little bit more redundancy for some of the services I host.

At the time, I was hosting a number of services with Xen. One physical server hosted 3 or 4 virtual servers. After a certain amount of reading over different solutions, I decided to convert all my production virtual servers to Linux-vserver. I'm not advocating either solution here. I'm simply going to point out my reasons for changing and hopefully help my readers understand the issue more.

Continue reading 'Linux-Vserver vs Xen'

Keeping a process running

Have you ever had a process that dies on occasion? For me, I hate that situation and prefer to fix the software as opposed to have a monitor that restarts the process when it dies. I've run into a case lately however, that has defied me for a solution to my dying process. I think it may be a hardware related issue but haven't tracked down the cause yet. Anyhow, I read an email on the Provo Linux User Group in which the poster referred to PS-Watcher. I thought I'd give it a try for kicks.

After installing the program and reading through the documentation, I found that PS-Watcher is really quite nice. In addition to monitoring the results of the ps command, you can add custom actions that occur at the beginning or ending of the monitor cycle ($PROLOG and $EPILOG). You can also customize actions to be taken based on the number of processes, memory size, and a few other useful metrics.

For most situations where you want to monitor a process and take action, I think PS-Watcher will probably do the job nicely. After all this however, I decided what I really wanted was a little script that did a custom restart of my particular web server when the test URL wasn't functioning properly. I decided to simply run it on a scheduled interval with cron. I've placed the script below for all to glean information from or make fun of as appropriate. Feel free to provide some additional tips as I don't claim to be a "Bash Jedi Master". The following script sends a request to the web server and parses the response for a string that lets us know the server is working properly.

#!/bin/bash

user="<the user my process is running under>"
port="<the port>"
okresp="^OK$" # I configured a test URL that returns OK if the server is up and running right.

# make a simple HTTP request to send
req="GET /lbuptest HTPP/1.0

"
# send it using netcat
resp=$(echo "$req" | nc localhost $port)
# test for the ok string
ok=0
echo "$resp" | grep $okresp 2>&1 >> /dev/null && ok="1"

# you could really place whatever actions you want here.
if [[ $ok != "1" ]]; then
/etc/init.d/<my process init script> restart
fi

The process I'm having trouble with is a TurboGears web application. I don't think this is a Python problem however. Like I mentioned before, it only happens on this one server so I think I've got a hardware problem. Either way, if you found this page searching for TurboGears information, you might as well be interested in my TurboGears Init Scripts.



css.php