Commit 88a3d3ae authored by Boxiang Sun's avatar Boxiang Sun

temp fixup

parent 332604e9
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
[template-matomo-instance] [template-matomo-instance]
filename = matomo-instance.cfg.in filename = matomo-instance.cfg.in
md5sum = 65fe09694eac010a8c58ba3416ccc98f md5sum = 6b681b0ba74ed68ca18e36ff6a18f19d
[template-matomo-backup.sh] [template-matomo-backup.sh]
filename = matomo-backup.sh.in filename = matomo-backup.sh.in
...@@ -27,4 +27,4 @@ md5sum = 291a70f3809aa6c7338f34c4bac36577 ...@@ -27,4 +27,4 @@ md5sum = 291a70f3809aa6c7338f34c4bac36577
[custom-promise] [custom-promise]
filename = promise/check_cron_service.py filename = promise/check_cron_service.py
md5sum = f93a23c08c4f6b864e931c7b4e767a0c md5sum = f6c51545dd52dedff27635da2216b9ba
...@@ -11,7 +11,7 @@ cron-entries = ${cron:cron-entries} ...@@ -11,7 +11,7 @@ cron-entries = ${cron:cron-entries}
name = matomo-backup name = matomo-backup
frequency = * * * * * frequency = * * * * *
log-file = ${directory:log}/matomo-backup.log log-file = ${directory:log}/matomo-backup.log
command = ${matomo-backup.sh:output} 2>&1 | ${xxx.sh:output} > ${:log-file} command = ${matomo-backup.sh:output}; echo $? > ${:log-file}
[matomo-backup.sh] [matomo-backup.sh]
recipe = slapos.recipe.template:jinja2 recipe = slapos.recipe.template:jinja2
......
...@@ -30,7 +30,7 @@ class RunPromise(GenericPromise): ...@@ -30,7 +30,7 @@ class RunPromise(GenericPromise):
if not os.path.isfile(cron_log_path): if not os.path.isfile(cron_log_path):
self.logger.error("cron_log %s does not exist or is not a file", cron_log_path) self.logger.error("cron_log %s does not exist or is not a file", cron_log_path)
target_string = "exit 1" target_string = "1"
partition_path = self.getConfig('partition_path')[:-3] partition_path = self.getConfig('partition_path')[:-3]
cron_service_name = self.getConfig('cron_name') cron_service_name = self.getConfig('cron_name')
...@@ -59,8 +59,8 @@ class RunPromise(GenericPromise): ...@@ -59,8 +59,8 @@ class RunPromise(GenericPromise):
try: try:
with open(cron_log_file, "r") as file: with open(cron_log_file, "r") as file:
log_content = file.read() log_content = file.read()
if "exit 1" in log_content: if "0" not in log_content:
self.logger.error(f"Cron service {cron_service_name} failed: {log_content}") self.logger.error(f"Cron service {cron_service_name} failed with the code: {log_content}")
print(log_content) print(log_content)
except FileNotFoundError: except FileNotFoundError:
print(f"File not found: {cron_log_file}") print(f"File not found: {cron_log_file}")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment