-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
deleteoldbackups.sh uses /root/backups #17
Comments
Bizarre... /root/backups isn't 'hard-coded' anywhere within the deleteoldbackups.sh script. It should be loading the config from your backup.cfg. Are you absolutely certain you do not have /root/backups set in your config for either REMOTEDIR or LOCALDIR. The phrase '/root/backups' only exists within the config...it is not hard coded anywhere. |
Not that I can see, which is why I included the output of the grep command in my report. Unless I should be looking somewhere else that I missed as well. |
Hmm... Could you please paste LOCALDIR and REMOTEDIR from backup.cfg? |
A possibility is that when you ran the backup script previously, it's populated your environment variables with the contents of the script, and for whatever reason re-running the script isn't overwriting them. The easiest way to check would probably be to just try echo $LOCALDIR and echo $REMOTEDIR. EDIT: Apologies, I was not aware that Bash actually had a concept of scoping for environment variables, so the script won't interfere with your bash environment out of the script. |
... Checking for REMOTE backups to delete... All done. Backup and transfer completed in 6 seconds root@compaq:/backups/bin# echo $LOCALDIR root@compaq:/backups/bin# echo $REMOTEDIR root@compaq:/backups/bin# fgrep LOCALDIR *cfg |
Hmm, that's very strange. Could you please try manually running "deleteoldbackups.sh" and "deleteoldbackups.sh --remote", and see if either or both of them give the "No such file or directory" error. The first command should use $LOCALDIR and the second should use $REMOTEDIR. I'm really unsure as to where it's grabbing /root/backups from though, as it's not in the environment, or the variables, or even hardcoded. |
root@nigelhorne:/backups/bin# ./deleteoldbackups.sh I don't understand it either :-( |
Also I just did this: root@nigelhorne:/backups/bin# env | grep /root So it's not coming from the environment I already have. |
Ah, at least based on your output from deleteoldbackup.sh it appears that it's only $LOCALDIR that has the issue. I suppose as a next step you could possibly try re-downloading the files, and seeing if the issue persists. |
I tried, but no change. |
Perhaps it happens because for some reason BACKUPDIR isn't set. How about a wrapper such as this (untested) if [ "x$BACKUPDIR" == x]; then cd "${BACKUPDIR}" || exit 1 Or better still check that LOCALDIR and REMOTEDIR are set when setting BACKUPDIR. |
Why does deleteoldbackups.sh give this error:
/backups/bin/deleteoldbackups.sh: line 59: cd: /root/backups/: No such file or directory
/root/backups appears nowhere in my configuration file:
root@nigelhorne:/backups/bin# fgrep /root *
root@nigelhorne:/backups/bin# ls -l
total 20
-r-------- 1 root root 2184 Jul 24 14:14 backup.cfg
-rwxrwxr-x 1 root root 4318 Jul 24 14:16 backup.sh
-rwxrwxr-x 1 root root 5438 Jul 24 13:39 deleteoldbackups.sh
root@nigelhorne:/backups/bin#
The text was updated successfully, but these errors were encountered: