diff --git a/Dockerfile b/Dockerfile index 67261c1..c907b96 100644 --- a/Dockerfile +++ b/Dockerfile @@ -9,7 +9,7 @@ RUN yarn bundle FROM node:alpine COPY entry.sh /entry.sh -RUN chmod 711 /entry.sh && apk update && apk add git +RUN chmod 755 /entry.sh && apk update && apk add git COPY --from=BuildEnv /app/dist /app CMD ["schedule"] ENTRYPOINT ["/entry.sh"] diff --git a/README.md b/README.md index e0b9f3e..74f7bf6 100644 --- a/README.md +++ b/README.md @@ -37,3 +37,6 @@ You can also limit which repositories to back up using the environment variables | | | |-... ``` +## Scheduled + +If the container is started without a command it will run in scheduled mode. It will run every Sunday at 3 am. This can be overridden using `-e SCHEDULE="0 0 4 * * *"` (Runs at 4 am every day) using the cron time format diff --git a/src/index.ts b/src/index.ts index 178a2e9..808089c 100644 --- a/src/index.ts +++ b/src/index.ts @@ -9,7 +9,9 @@ run.action(runBackup) const schedule = program.command('schedule'); schedule.action(() => { const schedule = process.env.SCHEDULE || '0 0 3 * * Sunday'; + console.log(`Starting with schedule ${schedule}`) cron.schedule(schedule, () => { + console.log('Starting backup task') runBackup().catch((err) => { console.error(err); process.exit(-1);