welldesign wrote: ↑Fri Oct 02, 2020 10:34 am
We need an individual schedule for remote backups so that daily backups for the last 7 days are stored locally, and weekly backups for the last couple of months are stored on the remote FTP server.
I have create a script to do almost exactly this using rclone to my Google Drive (rather than FTP) - I'm not very proficient with bash, but I managed to kludge together the script and it works perfectly if I run it in a terminal window. The problem I'm having is how to get that script to actually run as a cron job.
I have a cron job set to run a couple hours after the backups are done:
sudo /usr/bin/bash /backup/remote-backup.sh > /backup/remote-backup.log 2>&1
It fires, but I'm getting this message in the log:
sudo: no tty present and no askpass program specified
I did some searches about this error and found suggestions that the entry in sudoers was either missing or incorrect. From what I can see the "admin" user, under which the cron jobs run, is only allowed to run the Vesta scripts using sudo?
# sudo is limited to vesta scripts
admin ALL=NOPASSWD:/usr/local/vesta/bin/*
I assume I could adjust the /etc/sudoers.d/admin file, but:
a) I believe that's dangerous to do manually and my knowledge of visudo is limited, so I don't know if it can be used to edit that admin file, and
b) I suspect any changes would be overwritten by future updates?
So I'm a little stuck on how to actually automate the process. Happy to share the process and script.