Koozali.org: home of the SME Server
Obsolete Releases => SME 7.x Contribs => Topic started by: Stuart on May 14, 2008, 07:37:09 AM
-
Please be kind, I have had a backup script working but recently have encountered no end of trouble. The script was made as per the help I had in this thread .... http://forums.contribs.org/index.php?topic=40625.0 (http://forums.contribs.org/index.php?topic=40625.0)
The current script...
#!/bin/sh
signal-event pre-backup
cd /
tar czf /home/e-smith/files/ibays/backup/files/smeserver.tgz `perl -e 'use esmith::Backup; $b=new esmith::Backup; print join("\n",$b->restore_list)'` --exclude='home/e-smith/files/ibays/backup/files/smeserver.tgz'
signal-event post-backup
Results in the following...
Can't open directory /etc/e-smith/events/pre-backup
desktop_backup.sh: line 3: cd: /
: No such file or directory
tar: /home/e-smith/files/ibays/backup/files/smeserver.tgz: Cannot open: No such file or directory
tar: Error is not recoverable: exiting now
tar: home/e-smith: Cannot stat: No such file or directory
tar: etc/e-smith/templates-custom: Cannot stat: No such file or directory
tar: etc/e-smith/templates-user-custom: Cannot stat: No such file or directory
tar: etc/ssh: Cannot stat: No such file or directory
tar: root: Cannot stat: No such file or directory
tar: etc/sudoers: Cannot stat: No such file or directory
tar: etc/passwd: Cannot stat: No such file or directory
tar: etc/shadow: Cannot stat: No such file or directory
tar: etc/group: Cannot stat: No such file or directory
tar: etc/gshadow: Cannot stat: No such file or directory
tar: etc/samba/secrets.tdb: Cannot stat: No such file or directory
tar: etc/samba/smbpasswd: Cannot stat: No such file or directory
tar: etc/smbpasswd: Cannot stat: No such file or directory
I have played around with this to no end, but can only seem to produce different errors.
As always, what am I missing?
-
Did you try some sort of restore? I find it hard to imagine that a backup leads to problems like this as it seems you cannot cd to the root (cd /) of your file system.
The backup command works perfectly on my system if I create a backup ibay.
What user is executing the script? Can you access the root as that user form the SME Server shell?
-
Looks to be an ownership/rights issues when the script is executed, which leads me to ask, how are you executing the script?
Next, why bother with such a script when backup contribs are available?
Darrell
-
Guys, I am trying to run this logged in as root using the command
sh dbackup.sh
The idea is to put it in Cron.daily, the resulting tarball is collected by the backup server.
If you look at the output it is actually failing on the first line, which probably is causing the cd / to be sent incorrectly.
Next, why bother with such a script when backup contribs are available?
Seems like a simple easy solution that suits our setup.
-
which probably is causing the cd / to be sent incorrectly.
Set the root directory as a persistent variable in your script:
ROOTDIR=/
cd $ROOTDIR
Darrell
-
Thanks but the script actually fails on the first line
signal-event pre-backup
as evidenced by the output
Can't open directory /etc/e-smith/events/pre-backup
-
Thanks but the script actually fails on the first line
signal-event pre-backup
as evidenced by the output
Can't open directory /etc/e-smith/events/pre-backup
Then you are doing something seriously wrong or you system is messed up. I did the following and it worked like a charm:
Logged in as root
nano /tmp/test.sh
copied the code you suggested in there
Ctrl+X, Y to save
chmod +x /tmp/test.sh
/tmp/test.sh
The script ran error free and the created archive contains the folders and files it should hold.
Please see if you can reproduce the error following above scheme, as I did.
-
Fixed.
It appears the encoding of the file was getting messed up, although this was not apparent in pico. I created a new script using nano and retyped the entire script and it now works perfectly.
@ cactus, thanks so much for running that on your system and proving that it should work.
Please see if you can reproduce the error following above scheme, as I did.
:D