Есть скрипт, который я задал через
crontab -e
* * * * * docker exec -i $(docker ps -aqf "name=prod_backend" | head -1) python manage.py dumpdata >> ~/django_backups/dump_`date +%d-%m-%Y"_"%H_%M_%S`.json
каждую минуту он должен делать бекап базы
но он не работает, директория такая есть
если вручную выполнить скрипт, всё работает
sudo service cron status
● cron.service - Regular background program processing daemon
Loaded: loaded (/lib/systemd/system/cron.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2023-08-29 20:49:05 UTC; 1 months 5 days ago
Docs: man:cron(8)
Main PID: 785 (cron)
Tasks: 1 (limit: 2256)
Memory: 12.3M
CGroup: /system.slice/cron.service
└─785 /usr/sbin/cron -f
Oct 04 13:15:01 postgresql-production CRON[2415431]: (CRON) info (No MTA installed, discarding output)
Oct 04 13:15:01 postgresql-production CRON[2415431]: pam_unix(cron:session): session closed for user root
Oct 04 13:16:01 postgresql-production CRON[2415473]: pam_unix(cron:session): session opened for user root by (uid=0)
Oct 04 13:16:01 postgresql-production CRON[2415474]: (root) CMD (docker exec -i $(docker ps -aqf "name=prod_backend" | head -1) python manage.py dumpdata >> ~/djan>
Oct 04 13:16:01 postgresql-production CRON[2415473]: (CRON) info (No MTA installed, discarding output)
Oct 04 13:16:01 postgresql-production CRON[2415473]: pam_unix(cron:session): session closed for user root
Oct 04 13:17:01 postgresql-production CRON[2415530]: pam_unix(cron:session): session opened for user root by (uid=0)
Oct 04 13:17:01 postgresql-production CRON[2415533]: (root) CMD (docker exec -i $(docker ps -aqf "name=prod_backend" | head -1) python manage.py dumpdata >> ~/djan>
Oct 04 13:17:01 postgresql-production CRON[2415530]: (CRON) info (No MTA installed, discarding output)
Oct 04 13:17:01 postgresql-production CRON[2415530]: pam_unix(cron:session): session closed for user root
tail -f /var/log/syslog
Oct 4 13:16:44 postgresql-production crontab[2415407]: (root) END EDIT (root)
Oct 4 13:16:50 postgresql-production kernel: [3083405.420347] [UFW BLOCK] IN=eth0 OUT= MAC=02:8f:8c:f7:45:79:fe:00:00:00:01:01:08:00 SRC=23.243.190.118 DST=134.209.224.46 LEN=40 TOS=0x00 PREC=0x00 TTL=49 ID=27355 PROTO=TCP SPT=4186 DPT=23 WINDOW=20498 RES=0x00 SYN URGP=0
Oct 4 13:17:01 postgresql-production CRON[2415531]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Oct 4 13:17:01 postgresql-production CRON[2415533]: (root) CMD (docker exec -i $(docker ps -aqf "name=prod_backend" | head -1) python manage.py dumpdata >> ~/django_backups/dump_`date +)
Oct 4 13:17:01 postgresql-production CRON[2415530]: (CRON) info (No MTA installed, discarding output)
Oct 4 13:17:02 postgresql-production kernel: [3083417.867964] [UFW BLOCK] IN=eth0 OUT= MAC=02:8f:8c:f7:45:79:fe:00:00:00:01:01:08:00 SRC=23.243.190.118 DST=134.209.224.46 LEN=40 TOS=0x00 PREC=0x00 TTL=49 ID=27355 PROTO=TCP SPT=4186 DPT=23 WINDOW=20498 RES=0x00 SYN URGP=0
Oct 4 13:17:18 postgresql-production kernel: [3083434.202221] [UFW BLOCK] IN=eth0 OUT= MAC=02:8f:8c:f7:45:79:fe:00:00:00:01:01:08:00 SRC=89.248.165.64 DST=10.19.0.5 LEN=40 TOS=0x00 PREC=0x00 TTL=249 ID=49343 PROTO=TCP SPT=56101 DPT=47870 WINDOW=1024 RES=0x00 SYN URGP=0
Oct 4 13:17:41 postgresql-production kernel: [3083456.333305] [UFW BLOCK] IN=eth0 OUT= MAC=02:8f:8c:f7:45:79:fe:00:00:00:01:01:08:00 SRC=23.243.190.118 DST=134.209.224.46 LEN=40 TOS=0x00 PREC=0x00 TTL=49 ID=27355 PROTO=TCP SPT=4186 DPT=23 WINDOW=20498 RES=0x00 SYN URGP=0
Oct 4 13:18:01 postgresql-production CRON[2415586]: (root) CMD (docker exec -i $(docker ps -aqf "name=prod_backend" | head -1) python manage.py dumpdata >> ~/django_backups/dump_`date +)
Oct 4 13:18:01 postgresql-production CRON[2415585]: (CRON) info (No MTA installed, discarding output)