automatic backups are failing #31

Closed
opened 2023-08-21 16:08:47 +00:00 by CJ_Clippy · 4 comments
Owner

Verifying old backups today. Found no 2023-08-20 backup folder. What's going on here?

This is a regression

reference https://github.com/insanity54/futureporn/issues/141

Verifying old backups today. Found no 2023-08-20 backup folder. What's going on here? This is a regression reference https://github.com/insanity54/futureporn/issues/141
Author
Owner
× daily-backup.service - futureporn-db Daily Backup
     Loaded: loaded (/etc/systemd/system/daily-backup.service; enabled; vendor preset: enabled)
     Active: failed (Result: exit-code) since Mon 2023-08-21 00:00:01 UTC; 16h ago
TriggeredBy: ● daily-backup.timer
    Process: 751400 ExecStart=/opt/daily-backup.sh (code=exited, status=203/EXEC)
   Main PID: 751400 (code=exited, status=203/EXEC)
        CPU: 1ms

Aug 21 00:00:01 replicator systemd[1]: Starting futureporn-db Daily Backup...
Aug 21 00:00:01 replicator systemd[751400]: daily-backup.service: Failed to locate executable /opt/daily-backup.sh: Permission denied
Aug 21 00:00:01 replicator systemd[751400]: daily-backup.service: Failed at step EXEC spawning /opt/daily-backup.sh: Permission denied
Aug 21 00:00:01 replicator systemd[1]: daily-backup.service: Main process exited, code=exited, status=203/EXEC
Aug 21 00:00:01 replicator systemd[1]: daily-backup.service: Failed with result 'exit-code'.
Aug 21 00:00:01 replicator systemd[1]: Failed to start futureporn-db Daily Backup.
``` × daily-backup.service - futureporn-db Daily Backup Loaded: loaded (/etc/systemd/system/daily-backup.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since Mon 2023-08-21 00:00:01 UTC; 16h ago TriggeredBy: ● daily-backup.timer Process: 751400 ExecStart=/opt/daily-backup.sh (code=exited, status=203/EXEC) Main PID: 751400 (code=exited, status=203/EXEC) CPU: 1ms Aug 21 00:00:01 replicator systemd[1]: Starting futureporn-db Daily Backup... Aug 21 00:00:01 replicator systemd[751400]: daily-backup.service: Failed to locate executable /opt/daily-backup.sh: Permission denied Aug 21 00:00:01 replicator systemd[751400]: daily-backup.service: Failed at step EXEC spawning /opt/daily-backup.sh: Permission denied Aug 21 00:00:01 replicator systemd[1]: daily-backup.service: Main process exited, code=exited, status=203/EXEC Aug 21 00:00:01 replicator systemd[1]: daily-backup.service: Failed with result 'exit-code'. Aug 21 00:00:01 replicator systemd[1]: Failed to start futureporn-db Daily Backup. ```
Author
Owner

I implemented a fix.

chmod 755 /opt/daily-backup.sh
systemctl restart daily-backup.service

(got an error about b2 key scoped permissions)

b2-linux authorize-account --profile futureporn-db-backup xxxx xxxx
systemctl restart daily-backup.service

looks good now. 👍
will verify in a day and in a week.

I implemented a fix. ``` chmod 755 /opt/daily-backup.sh systemctl restart daily-backup.service ``` (got an error about b2 key scoped permissions) ``` b2-linux authorize-account --profile futureporn-db-backup xxxx xxxx systemctl restart daily-backup.service ``` looks good now. 👍 will verify in a day and in a week.
Author
Owner

just for saving

# /etc/systemd/system/daily-backup.service
[Unit]
Description=futureporn-db Daily Backup

[Service]
Type=oneshot
ExecStart=/opt/daily-backup.sh

[Install]
WantedBy=multi-user.target
#!/bin/bash

# /opt/daily-backup.sh

# useful for the dokku server
# dokku's backup feature is broken atm https://github.com/dokku/dokku-postgres/issues/274
# backups are exported from dokku:postgres plugin before being sent to b2


filename="$(date +'%Y-%m-%d_%H-%M-%S').psql"

dokku postgres:export futureporn-db > "${filename}"
b2-linux upload-file --profile futureporn-db-backup futureporn-db-backup "./${filename}" "${filename}"
# /etc/systemd/system/daily-backup.timer
[Unit]
Description=futureporn-db Daily Backup Timer

[Timer]
OnCalendar=*-*-* 00:00:00
Persistent=true

[Install]
WantedBy=timers.target
just for saving ``` # /etc/systemd/system/daily-backup.service [Unit] Description=futureporn-db Daily Backup [Service] Type=oneshot ExecStart=/opt/daily-backup.sh [Install] WantedBy=multi-user.target ``` ```bash #!/bin/bash # /opt/daily-backup.sh # useful for the dokku server # dokku's backup feature is broken atm https://github.com/dokku/dokku-postgres/issues/274 # backups are exported from dokku:postgres plugin before being sent to b2 filename="$(date +'%Y-%m-%d_%H-%M-%S').psql" dokku postgres:export futureporn-db > "${filename}" b2-linux upload-file --profile futureporn-db-backup futureporn-db-backup "./${filename}" "${filename}" ``` ``` # /etc/systemd/system/daily-backup.timer [Unit] Description=futureporn-db Daily Backup Timer [Timer] OnCalendar=*-*-* 00:00:00 Persistent=true [Install] WantedBy=timers.target ```
Author
Owner

24 hour verification check complete. nominal.

24 hour verification check complete. nominal.
Sign in to join this conversation.
No description provided.