Issue #799 Added systemd restart templates

This commit is contained in:
Bruno Lottero 2022-10-31 15:31:30 -03:00
parent dde83d5a7c
commit fabe2ffa2f
1 changed files with 20 additions and 0 deletions

View File

@ -84,6 +84,22 @@ OnCalendar=daily
[Install]
WantedBy=timers.target
`,
},
{
Path: "/etc/systemd/system/cloudflared-restart.path",
Content: `[Path]
PathChanged=/usr/bin/cloudflared
[Install]
WantedBy=multi-user.target
`,
},
{
Path: "/etc/systemd/system/cloudflared-restart.service",
Content: `[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart cloudflared
`,
},
}
@ -273,6 +289,10 @@ func installSystemd(templateArgs *ServiceTemplateArgs, log *zerolog.Logger) erro
log.Err(err).Msgf("systemctl enable %s error", cloudflaredService)
return err
}
if err := runCommand("systemctl", "enable", "cloudflared-restart.path"); err != nil {
log.Err(err).Msg("systemctl enable cloudflared-restart.path error")
return err
}
if err := runCommand("systemctl", "start", "cloudflared-update.timer"); err != nil {
log.Err(err).Msg("systemctl start cloudflared-update.timer error")
return err