Home > openstack > Run Swift Servers in a screen session

Run Swift Servers in a screen session

After you install swift, you may want to run all of the swift servers in a session where you can manage (stop/restart) them conveniently. This note tell you how:   Run the following script to configure:


# the session name is used in session creation
SESSION_NAME=${SESSION_NAME:-zwift}

# on first run it creates a  session and run the command inside the session.
# on subsequent run it run the command inside the existing session.
function do_screen() {
    # $1 – name
    # $2 – command to execute
    if (! screen -ls | grep -q ${SESSION_NAME}); then
        screen -S ${SESSION_NAME} -dm -t $1
    else
        screen -S ${SESSION_NAME} -X screen -t $1
    fi
    sleep 1.5
    screen -S ${SESSION_NAME} -p $1 -X stuff “$2”
}
# assuming your swift servers are in /usr/bin directory.
for service in proxy object container account; do
    echo “starting ${service}…”
    do_screen ${service} “/usr/bin/swift-${service}-server -v /etc/swift/${service}-server.conf”$’\n’
done

Advertisements
Categories: openstack
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: