update mysql_database_config.rb

This commit is contained in:
connorc@orbitnode.net 2023-03-19 18:19:17 -06:00
parent dfbe572c9e
commit 9a7eacf05d

View File

@ -55,6 +55,17 @@ class MysqlDatabaseConfig
@logger.error("An error occurred while generating MySQL database configuration file: #{e.message}") @logger.error("An error occurred while generating MySQL database configuration file: #{e.message}")
@logger.debug("Backtrace: #{e.backtrace}") @logger.debug("Backtrace: #{e.backtrace}")
end end
# ask the user if they want to setup a cron job for the program
cron_job = prompt_bool('Do you want to setup a cron job for this program?', default: false)
if cron_job
# how often the program should run
cron_interval = prompt('How often do you want the program to run? (in minutes, e.g. "60" for every hour)',
default: '60').to_i
# write the cron job to crontab
`echo "*/#{cron_interval} * * * * /usr/bin/PixelatedStudios/Ruby/Ru-b2-SQL-Backups/starter.rb" >> /etc/crontab`
@logger.info("Cron job added to /etc/crontab to run every #{cron_interval} minutes.")
end
end end
end end