Quote:
So I can take out the rm command
|
Whoops, i misread the code: i thought you were deleting the file /Downloads/html.bak/htmlbackup.sh.tar.gz rather than the file /srv/www/html/htmlbackup.sh.tar.gz. Sorry! So no you do not remove the rm command.
Quote:
with your top script wouldn't it be better if the tar was before the rm like so, or have I got it wrong.
|
No it wont archive if you do not delete it first even if it did your whole script would be pointless because it would backup the file then delete it right afterwards (so you have no backup). If you have the rm command first it will delete the file when you are backing up. Or if by that you mean you do not want the file htmlbackup.sh.tar.gz in /srv/www/html then add the rm command after te line cp /srv/www/html/htmlbackup.sh.tar.gz /Downloads/html.bak/htmlbackup.sh.tar.gz
Quote:
I'm getting the following email in root mail. if you get what I mean
Code:
/folder/folder/htmlbackup.sh: line 1: !/bin/bash: No such file or directory rm: cannot remove `/folder/folder/htmlbackup.sh.tar.gz': No such file or directory
|
To stop getting that there is a simple solution which is just to create the file /folder/folder/htmlbackup.sh.tar.gz Then after that as there is a file to delete so you wont get an error and the script can run the whole way through (as the error stops it before it creates the file htmlbackup.sh.tar.gz).
Hope that helps.