summaryrefslogtreecommitdiffstats
path: root/roles/docker_img_puppet/files/puppet_container/service.rb
blob: 40779c2705a0f74cd40ae5dc330ac0f7f716917b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/usr/bin/env ruby

require 'fileutils'

if __FILE__ == $0
  abort "\nUsage: #{File.basename($0)} <name> <action>\n\n" unless ARGV.size == 2

  name = ARGV[0]
  action = ARGV[1]

  SERVICE_IPC_DIR = '/var/run/ctr-ipc/service'

  FileUtils.mkdir_p(SERVICE_IPC_DIR)

  File.open("#{SERVICE_IPC_DIR}/#{name}", 'w') do |f|
    f.print action
  end
end