Skip to content

Instantly share code, notes, and snippets.

@marzdgzmn
Created December 12, 2017 06:56
Show Gist options
  • Save marzdgzmn/7c4a1e51a7be9a208acc3d3af5e34f2e to your computer and use it in GitHub Desktop.
Save marzdgzmn/7c4a1e51a7be9a208acc3d3af5e34f2e to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'fileutils'
require 'inifile'
require 'parse-cron'
require 'socket'
module MirrorFileUtils
BASE_DIR = '/usr/local/mirror'
CONF_DIR = BASE_DIR + '/conf'
LOG_DIR = '/var/log/mirror/logs'
ETC_DIR = BASE_DIR + '/etc'
BIN_DIR = BASE_DIR + '/bin'
LIB_DIR = BASE_DIR + '/lib'
DATA_DIR = BASE_DIR + '/data'
CONF_FILE = CONF_DIR + '/sync.conf'
DAEMON_LOG = LOG_DIR + '/mirrorsync.log'
BWLIMIT_FILE = CONF_DIR + '/bwlimit'
def self.create_directory(dir)
FileUtils.mkdir_p dir
end
def self.create_file(file)
unless File.exist?(file)
FileUtils.mkdir_p(File.dirname(file), :mode => 0755)
FileUtils.touch file
File.chmod(0644, file)
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment