-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Restore the "active from" timestamp - Add to backup/restore the "active to" timestamp
- Loading branch information
1 parent
abc7c42
commit 8a214d0
Showing
5 changed files
with
53 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#!/usr/bin/env python3 | ||
|
||
# | ||
# Copyright (C) 2024 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
import sys | ||
import json | ||
import agent | ||
import datetime | ||
import os | ||
|
||
if "LOKI_ACTIVE_TO" in original_environment: | ||
agent.set_env("LOKI_ACTIVE_TO", original_environment["LOKI_ACTIVE_TO"]) | ||
else: | ||
try: | ||
agent.set_env("LOKI_ACTIVE_TO", datetime.datetime.fromtimestamp(os.stat('active_to.tstamp').st_mtime).astimezone().isoformat()) | ||
except Exception as ex: | ||
print(agent.SD_WARNING + "Cannot restore LOKI_ACTIVE_TO:", str(ex), file=sys.stderr) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (C) 2024 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
set -e | ||
|
||
# Redirect any output to the journal (stderr) | ||
exec 1>&2 | ||
|
||
rm -vf active_to.tstamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
|
||
# | ||
# Copyright (C) 2024 Nethesis S.r.l. | ||
# SPDX-License-Identifier: GPL-3.0-or-later | ||
# | ||
|
||
set -e | ||
|
||
# Redirect any output to the journal (stderr) | ||
exec 1>&2 | ||
|
||
touch active_to.tstamp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
volumes/loki-server-data | ||
state/active_to.tstamp |