Created
December 12, 2017 06:56
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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