juretta.com

Restart lighttpd and Rails

May 16, 2006
Tags: lighttpd Rails Server
Small shell script to restart lighttpd. The script kills all dispatch.fcgi processes and restarts the webserver.
#!/bin/bash
# Autor: Stefan Saasen 

# lighttpd stop
#kill -KILL $(ps -ax | grep "lighttpd.conf" | \
                             grep -v "grep" | awk '{print $1}')
echo "Stopping lighttpd..."
sudo /etc/init.d/lighttpd stop

# Ruby stop
echo "kill dispatch.fcgi processes..."
for i in $(ps aux | egrep "^www-data(.*)dispatch.fcgi" | \
             grep -v "grep" | awk '{print $2}'); do kill -KILL $i; done

# lighttpd start
echo "start lighttpd"
sudo /etc/init.d/lighttpd start

About

This is the defunct blog of Stefan Saasen.