ben@nagios1:/var/log/nagios3$ grep 'mycheck-or-host' nagios.log |perl -pe 's/(\d+)/localtime($1)/e'
The perl snippet will translate the epoch-style timestamp to one that is readable.
ben@nagios1:/var/log/nagios3$ grep 'mycheck-or-host' nagios.log |perl -pe 's/(\d+)/localtime($1)/e'
ben.foo
) and you're ready to squash a bunch of commits and push it back up to master.git fetch* set your upstream to master
git branch --set-upstream ben.foo origin/master* rebase all your changes that are different from master
git rebase* squash all your commits
git rebase -i* push them up, forcing your branch to remove your previous more verbose commits
git push origin +ben.fooWhee!! You're done!
git log* Do an interactive git rebase from that commit on
git rebase -i abcd1234* squash all but the first commit (or however you want to collapse your commit history)
2Gv}:s/^pick/squash/<ret>:wq* push this up, using the same +branch force in the previous example, overwriting the remote repository's messy history
git push origin +ben.fooVoila! Your commit history is now clean
git reflog ben.fooThis is a complete history of the changes you've made to the branch. Choose the commit ID you want to backtrack to (eg abcd1234) and run
git reset --hard abcd1234Further Reading:
if node['foo']['bar']['baz']
do the stuff I want
end rescue NoMethodError
if node[:ganglia][:grid_name]
include_recipe "ganglia::default"
ganglia_python "apache" do
action :enable
end
end rescue NoMethodError
So a bunch of the random things that I deploy are not well-behaved services with init scripts and reload targets but random bits like a sinatra app or a hipchat bot. Being internal tools that are pretty stable, the easiest way to deploy these is to just nohup and background the command rather than setting everything up under monit or runit or something like that.
You'll see a number of posts talking about capistrano hanging when trying to use nohup (stackoverflow) but redirecting both stdout and stderr to /dev/null solves that one.
The problem I ran across is that the nohup would not actually succeed in launching the process. With my new favorite diagnostic tool watch -n 0.1 --differences 'ps auwwxf | grep -A3 -B3 ubuntu
(aka refresh all the processes running as the ubuntu user every 1/10th second), I saw that the nohup appear and disappear but the process it was trying to launch never stuck around.
I believe what's actually happening is that capistrano is closing the ssh connection it used to launch the nohup process before nohup succeeds in detaching the process. Closing the ssh shell than kills the nohup process before it finishes detaching its child, so the child dies too.
The solution is simple; give nohup a little more time to finish detaching its child before closing the ssh connection by appnding sleep 2
to the line: