diff --git a/aws-rotate-iam-keys.template.rb b/aws-rotate-iam-keys.template.rb index 7509d56..0ed226c 100644 --- a/aws-rotate-iam-keys.template.rb +++ b/aws-rotate-iam-keys.template.rb @@ -8,15 +8,9 @@ class AwsRotateIamKeys < Formula homepage "https://aws-rotate-iam-keys.com" url "${HOMEBREW_URL}" sha256 "${HOMEBREW_SHA}" - depends_on "awscli" => :recommended depends_on "gnu-getopt" depends_on "jq" - - head do - Dir.chdir(File.expand_path(File.join(File.dirname(__FILE__), '../'))) do - url %x{git config --local --get remote.origin.url | tr -d '\n'}, using: :git - end - end + depends_on "awscli" => :recommended def install bin.install "src/bin/aws-rotate-iam-keys" @@ -27,7 +21,7 @@ def install end def caveats - s = <<~EOS + <<~EOS We've installed a default/global configuration file to: #{etc}/aws-rotate-iam-keys @@ -50,42 +44,16 @@ def caveats EOS end - plist_options :startup => false - - def plist; <<~EOS - - - - - EnvironmentVariables - - PATH - /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin - - Label - #{plist_name} - ProgramArguments - - /bin/bash - -c - if ! curl -s www.google.com > /dev/null; then sleep 60; fi; cp /dev/null /tmp/#{plist_name}.log ; ( egrep '^[[:space:]]*-' ~/.aws-rotate-iam-keys 2>/dev/null || cat #{etc}/aws-rotate-iam-keys ) | while read line; do aws-rotate-iam-keys §line; done - - StandardOutPath - /tmp/#{plist_name}.log - StandardErrorPath - /tmp/#{plist_name}.log - RunAtLoad - - StartCalendarInterval - - Hour - 3 - Minute - 23 - - - - EOS + def log_path + var/"log/#{name}.log" + end + service do + run opt_bin/"aws-rotate-iam-keys" + run_type :cron + cron "0 10 * * *" + environment_variables PATH: std_service_path_env + log_path f.log_path + error_log_path f.log_path end test do