set monthly reboot default for k3s server to true
This commit is contained in:
parent
4f77c2f909
commit
4e46d84662
4 changed files with 7 additions and 6 deletions
|
@ -11,11 +11,13 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.filesystem.base.check
|
|||
* ATTENTION: Use with care!!
|
||||
*/
|
||||
fun Prov.scheduleMonthlyReboot() = task {
|
||||
// use controlled "shutdown" instead of direct "reboot"
|
||||
val shutdown = "/sbin/shutdown"
|
||||
|
||||
// ensure shutdown command exists
|
||||
if (checkFile(shutdown, sudo = true)) {
|
||||
// reboot each first Tuesday in a month at 3:00
|
||||
// use controlled "shutdown" instead of direct "reboot"
|
||||
createCronJob("50_monthly_reboot", "0 3 1-7 * 2", "shutdown -r now", "root")
|
||||
createCronJob("50_monthly_reboot", "0 3 1-7 * 2", "$shutdown -r now", "root")
|
||||
} else {
|
||||
addResultToEval(ProvResult(false, err = "$shutdown not found."))
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ data class K3sConfig(
|
|||
val certmanager: Certmanager? = null,
|
||||
val echo: Echo? = null,
|
||||
val reprovision: Reprovision = false,
|
||||
val monthlyReboot: Boolean = false,
|
||||
val monthlyReboot: Boolean = true,
|
||||
) {
|
||||
fun isDualStack(): Boolean {
|
||||
return node.ipv6 != null && loopback.ipv6 != null
|
||||
|
|
|
@ -29,6 +29,6 @@ class ScheduledJobsKtTest {
|
|||
val fqFilename = "/etc/cron.d/50_monthly_reboot"
|
||||
assertTrue(prov.checkFile(fqFilename), "")
|
||||
val actualFileContent = prov.fileContent(fqFilename, sudo = true)
|
||||
assertEquals("0 3 1-7 * 2 root shutdown -r now\n", actualFileContent)
|
||||
assertEquals("0 3 1-7 * 2 root /sbin/shutdown -r now\n", actualFileContent)
|
||||
}
|
||||
}
|
|
@ -8,7 +8,6 @@ import org.domaindrivenarchitecture.provs.framework.ubuntu.user.base.whoami
|
|||
import org.domaindrivenarchitecture.provs.test.defaultTestContainer
|
||||
import org.junit.jupiter.api.Assertions.assertEquals
|
||||
import org.junit.jupiter.api.Assertions.assertTrue
|
||||
import org.junit.jupiter.api.Disabled
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class CronJobsKtTest {
|
||||
|
@ -33,7 +32,7 @@ class CronJobsKtTest {
|
|||
|
||||
|
||||
@Test
|
||||
@Disabled // only for manual execution and manual check for the created files
|
||||
// @Disabled // only for manual execution and manual check for the created files
|
||||
// Test if cron-job is actually running, but needs manual checks
|
||||
fun createCronJob_which_creates_files_with_timestamp() {
|
||||
// given
|
||||
|
|
Loading…
Reference in a new issue