128
129
130
131
132
133
134
135
136
137
138
139
140
|
# File 'lib/cloudkeeper/cli.rb', line 128
def sync
initialize_sync options
File.open(Cloudkeeper::Settings[:'lock-file'], File::RDWR | File::CREAT, 0o644) do |file|
lock = file.flock(File::LOCK_EX | File::LOCK_NB)
Cloudkeeper::Managers::ApplianceManager.new.synchronize_appliances if lock
abort 'cloudkeeper instance is already running, quitting' unless lock
end
rescue Cloudkeeper::Errors::InvalidConfigurationError => ex
abort ex.message
rescue StandardError => ex
logger.error "Unexpected error: #{ex.message}"
raise ex
end
|