Skip to content
Snippets Groups Projects
Commit 6507f189 authored by Florian Gransee's avatar Florian Gransee Committed by Bert Palm
Browse files

update crontab_setup

parent e8f76851
No related branches found
No related tags found
3 merge requests!290C itest,!289some generic fixes and cleanup,!283492 add thing abstraction to services
......@@ -57,28 +57,28 @@ class CreateThingInCrontabHandler(AbstractHandler):
info = ""
comment = cls.mk_comment(thing)
uuid = thing.uuid
if thing.external_sftp is not None:
interval = int(thing.external_sftp.sync_interval)
if thing.ext_sftp is not None:
interval = int(thing.ext_sftp.sync_interval)
schedule = cls.get_schedule(interval)
script = "/scripts/sync_sftp.py"
keyfile = thing.external_sftp.private_key_path
keyfile = thing.ext_sftp.ssh_priv_key
command = f"{script} {uuid} {keyfile} > $STDOUT 2> $STDERR"
job.enable(enabled=thing.external_sftp.enabled)
job.enable(enabled=thing.ext_sftp.sync_enabled)
job.set_comment(comment, pre_comment=True)
job.setall(schedule)
job.set_command(command)
info = f"sFTP {thing.external_sftp.uri} @ {interval}s"
if thing.external_api is not None:
interval = int(thing.external_api.sync_interval)
info = f"sFTP {thing.ext_sftp.uri} @ {interval}s"
if thing.ext_api is not None:
interval = int(thing.ext_api.sync_interval)
schedule = cls.get_schedule(interval)
script = f"/scripts/sync_{thing.external_api.api_type_name}_api.py"
script = f"/scripts/sync_{thing.ext_api.api_type_name}_api.py"
target_uri = thing.database.url
command = f"""{script} {uuid} "{thing.external_api.settings}" {target_uri} > $STDOUT 2> $STDERR"""
job.enable(enabled=thing.external_api.enabled)
command = f"""{script} {uuid} "{thing.ext_api.settings}" {target_uri} > $STDOUT 2> $STDERR"""
job.enable(enabled=thing.ext_api.sync_enabled)
job.set_comment(comment, pre_comment=True)
job.setall(schedule)
job.set_command(command)
info = f"{thing.external_api.api_type_name}-API @ {interval}s"
info = f"{thing.ext_api.api_type_name}-API @ {interval}s"
return info
# alias
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment