Skip to content

Commit e73e488

Browse files
authored
Merge pull request #17 from igolman/chore/update-cronjob-environment #none
chore: update cronjob environment
2 parents db2e4a5 + b83d6e0 commit e73e488

File tree

4 files changed

+5
-6
lines changed

4 files changed

+5
-6
lines changed

src/crontab

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
10 2 * * * source /env.sh && rcb backup > /proc/1/fd/1
1+
10 2 * * * source /.env && rcb backup > /proc/1/fd/1
22

src/entrypoint.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/sh
22

33
# Dump all env vars so we can source them in cron jobs
4-
rcb dump-env > /env.sh
4+
rcb dump-env > /.env
55

66
# Write crontab
77
rcb crontab > crontab

src/restic_compose_backup/cli.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ def start_backup_process(config, containers):
241241
except Exception as ex:
242242
logger.exception(ex)
243243
errors = True
244-
244+
245245
# restart stopped containers after backup
246246
if len(containers.stop_during_backup_containers) > 0:
247247
utils.start_containers(containers.stop_during_backup_containers)
@@ -304,8 +304,7 @@ def crontab(config):
304304

305305

306306
def dump_env():
307-
"""Dump all environment variables to a script that can be sourced from cron"""
308-
print("#!/bin/bash")
307+
"""Dump all environment variables to a file that can be sourced from cron"""
309308
print("# This file was generated by stack-back")
310309
for key, value in os.environ.items():
311310
print("export {}='{}'".format(key, value))

src/restic_compose_backup/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33

44
class Config:
5-
default_backup_command = "source /env.sh && rcb backup > /proc/1/fd/1"
5+
default_backup_command = "source /.env && rcb backup > /proc/1/fd/1"
66
default_crontab_schedule = "0 2 * * *"
77

88
"""Bag for config values"""

0 commit comments

Comments
 (0)