gluon/package/gluon-scheduled-domain-switch/luasrc/lib/gluon/upgrade/950-gluon-scheduled-domain-switch
Matthias Schiffer 8a79d0249f
gluon-scheduled-domain-switch: move gluon-switch-domain to /lib/gluon/scheduled-domain-switch
This script is an implementation detail - let's not clutter the global
$PATH namespace with a script with such a generic name.
2020-06-30 23:49:01 +02:00

19 lines
508 B
Lua
Executable File

#!/usr/bin/lua
local site = require 'gluon.site'
local cronfile = "/usr/lib/micron.d/gluon-scheduled-domain-switch"
-- Check if domain switch is scheduled
if site.domain_switch() == nil then
-- In case no domain switch is scheduled, remove cronfile
os.remove(cronfile)
os.exit(0)
end
-- Only in case domain switch is scheduled
local f = io.open(cronfile, "w")
f:write("* * * * * /usr/bin/gluon-check-connection\n")
f:write("*/5 * * * * /lib/gluon/scheduled-domain-switch/switch-domain\n")
f:close()