Never been to TextSnippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world (or not, you can keep them private!)

Killing rogue dispatch.fcgi processes and starting lighttpd on TextDrive (See related posts)

By using this script to start lighttpd you can be sure you won't be leaving rogues dispatchers around sucking up memory and generally pissing jason off. Don't get caught with your pants down!

Make sure to change USERNAME below, as well as any paths that may be different in your case.

#Modified from Julik's original code posted to TextDrive forums.

pstab = `ps axww`

def kill_fcgi_proc(line)
  its = line.strip.split(/\s+/)
  pid = its[0]
  puts "KILLING #{line}"
  `kill -9 #{pid}`

if pstab =~ /\/usr\/local\/sbin\/lighttpd -f/
  puts "Lighttpd still running."


  pstab.scan(/^.*dispatch\.fcgi\s*$/) do |line|
    kill_fcgi_proc line

  pstab = `ps axww`
  if pstab =~ /dispatch\.fcgi/
    puts "Error, rogue dispatch.fcgi's still pissing jason off."
    puts "Rogue dispatch.fcgi's cleared, starting lighty!"
    `/usr/local/sbin/lighttpd -f /home/USERNAME/lighttpd/lighttpd.conf`

You need to create an account or log in to post comments to this site.

Related Posts