Fix crontab replace bug.

This commit is contained in:
BoHung Chiu 2022-03-17 10:05:44 +08:00
parent b50bc8e490
commit 752be34741
1 changed files with 4 additions and 0 deletions

View File

@ -21,6 +21,10 @@ elsif crontab_sync_jobs[0].include?("-23/12") #replace 12 hours to 24 hours
crontab_jobs = `crontab -l`
crontab_jobs = crontab_jobs.sub(crontab_sync_jobs[0],crontab_sync_jobs[0].sub("-23/12",""))
%x(CRON="#{crontab_jobs}" && (echo "$CRON" ) | crontab -)
elsif crontab_sync_jobs[0].include?("*/12") #replace 12 hours to 24 hours
crontab_jobs = `crontab -l`
crontab_jobs = crontab_jobs.sub(crontab_sync_jobs[0],crontab_sync_jobs[0].sub("*/12","0"))
%x(CRON="#{crontab_jobs}" && (echo "$CRON" ) | crontab -)
end
# Describe your gem and declare its dependencies:
Gem::Specification.new do |spec|