Skip to content

Instantly share code, notes, and snippets.

@neovintage
Created December 7, 2011 21:41
Show Gist options
  • Save neovintage/1444805 to your computer and use it in GitHub Desktop.
Save neovintage/1444805 to your computer and use it in GitHub Desktop.
`echo "#{Process.pid}" > #{Merb.root}/log/metrics_gen.pid`
`echo "#{Process.ppid}" > #{Merb.root}/log/metrics_gen.ppid`
#!/bin/bash
export PATH=$PATH:/usr/local/lib/site_ruby/1.8/rubygems
case $1 in
start)
cd /path/to/merb/root/directory;
echo $$ > /path/to/log/metrics_gen_master.pid
/path/to/rake twitter:metrics_gen MERB_ENV=production
;;
stop)
kill `cat /path/to/file/metrics_gen.ppid`
kill `cat /path/to/file/metrics_gen.pid`
kill `cat /path/to/file/metrics_gen_master.pid`
rm -rf /path/to/pid/files
;;
*)
echo "usage: twitter_worker {start|stop}" ;;
esac
exit 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment