Skip to content

Instantly share code, notes, and snippets.

@zev
Created September 1, 2010 09:08
Show Gist options
  • Save zev/560440 to your computer and use it in GitHub Desktop.
Save zev/560440 to your computer and use it in GitHub Desktop.
sample conditional shell checks
# rough if else ...
execute "restarting-mysql-with-custom-config" do
command "/etc/init.d/mysql restart"
only_if "pgrep mysqld"
end
execute "starting-mysql-with-custom-config" do
command "/etc/init.d/mysql start"
not_if "pgrep mysqld"
end
# or if the just run
execute "ensure-backend-exists" do
command "/usr/local/bin/make_complicated_action"
not_if "/usr/local/bin/check_action | grep target_data"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment