Sha256: 7c19ecfc85eb07328f3df4fc90b1b132896a7a2722393c2b373ee6bcec88edba
Contents?: true
Size: 1.37 KB
Versions: 1
Compression:
Stored size: 1.37 KB
Contents
class Setup def initialize @thisdir = File.join File.dirname(__FILE__) end def with_systemd copy_sample_conf install_systemd_service puts "Installed." puts "\nEdit #{SysWatchdog::DEFAULT_CONF_FILE} and start:" puts "systemctl start sys_watchdog" puts "\nTo check daemon status:" puts "systemctl status sys_watchdog" end def with_cron copy_sample_conf add_cron_line puts "Installed." puts "\nEdit #{SysWatchdog::DEFAULT_CONF_FILE} and uncomment the cron line added." end private def add_cron_line run "echo '#* * * * * root sys_watchdog once' >> /etc/crontab" end def install_systemd_service services_dir = "/lib/systemd/system/" if `which systemctl`.empty? STDERR.puts "SysWatchdog install requires systemctl. Aborting." exit 1 end unless File.exist? services_dir STDERR.puts "SysWatchdog install requires dir #{services_dir}. Aborting." exit 1 end copy "#{@thisdir}/../../util/sys_watchdog.service", services_dir run 'systemctl enable sys_watchdog' end def copy_sample_conf copy "#{@thisdir}/../../util/sys_watchdog_sample.yml", SysWatchdog::DEFAULT_CONF_FILE end def copy from, to puts "Copying #{from} to #{to}..." FileUtils.cp from, to end def run cmd puts "Running #{cmd}..." system cmd end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
sys_watchdog-0.1.1 | lib/sys_watchdog/setup.rb |