diff options
author | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
---|---|---|
committer | Stefan Wintermeyer <stefan.wintermeyer@amooma.de> | 2012-12-17 12:01:45 +0100 |
commit | b80bd744ad873f6fc43018bc4bfb90677de167bd (patch) | |
tree | 072c4b0e33d442528555b82c415f5e7a1712b2b0 /script/logout_phones | |
parent | 3e706c2025ecc5523e81ad649639ef2ff75e7bac (diff) |
Start of GS5.
Diffstat (limited to 'script/logout_phones')
-rwxr-xr-x | script/logout_phones | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/script/logout_phones b/script/logout_phones new file mode 100755 index 0000000..2a1f266 --- /dev/null +++ b/script/logout_phones @@ -0,0 +1,29 @@ +#! /usr/bin/env ruby + +begin + +APP_PATH = File.expand_path('../../config/application', __FILE__) +require File.expand_path('../../config/boot', __FILE__) +require APP_PATH + +begin + Rails.application.require_environment! +rescue ActiveRecord::AdapterNotSpecified => e + error "No such Rails environment: \"#{Rails.env}\"." + exit 1 +end + +phones = Phone.where(:nightly_reboot => true).each do |phone| + if ! phone.user_logout + $stderr.puts "#{phone.id} #{phone.mac_address} - #{phone.errors.messages.inspect}" + end +end + +rescue SignalException => e + $stderr.print "#{e.class.to_s}" + $stderr.print " (Signal #{e.signo.to_s})" if e.respond_to?(:signo) && e.signo + $stderr.puts "" + exit 130 +end + +exit 0 |