Hi,
me again. There is a little bug in the script. It says "mdir" which
should be "mkdir".
I have to point out, that this script has no to be run in the folder
"/home/sogo/Backup", but the store of the files is there. Also there is
no cleaning up yet. So the store will be filled until disk is full.
The script on the ftp-server is updated an the corrected code is in this
mail.
Sorry for that.
Best Regards
Philipp
--------------
#! /bin/sh
## Created by PILARKTO.NET - PvSA
## PvSA, 19.4.10
## PvSA, 28.3.2011
## PvSA, 9.6.2011: for all
## PvSA, 6.7.2011: su und Debug-Info
## DEBUG
#set -x
DATE="`date +'%Y%m%d_%H%M%S'`"
#STOOL="/usr/GNUstep/System/Tools/Admin/sogo-tool"
# Changed after upgrade to 1.3.9
STOOL="/usr/sbin/sogo-tool"
mkdir -p /home/sogo/Backup
cd /home/sogo/Backup
mkdir tmp_$DATE
chown sogo:sogo tmp_$DATE
chmod -R 770 tmp_$DATE
cd tmp_$DATE
if [ `whoami` = "sogo" ]; then
if [ "$1" = "-i" ]; then
$STOOL -v backup ./ ALL
else
$STOOL backup ./ ALL >> output 2>&1
fi
else
if [ "$1" = "-i" ]; then
su sogo -c "$STOOL -v backup ./ ALL"
else
su sogo -c "$STOOL backup ./ ALL" >> output 2>&1
fi
fi
#su sogo -c "sogo-tool backup ./ ALL" > /dev/null 2>&1
#echo "Exit-Code: $?"
#exit 1
if [ "$?" != "0" ];then
echo "!!!!!"
echo "Error: Backing up with sogo-tool failed"
echo ""
cat output
else
mkdir -p ../STORE/$DATE
chmod -R 770 ../STORE/$DATE
mv * ../STORE/$DATE/
fi
cd ..
rm -rf tmp_$DATE
---------------
Am 25.11.2011 10:52, schrieb Philipp v. Strobl-Albeg:
Hi,
as i reading the posts of sogo-tool, it reminds me to share my
sogo-tool (cron) script with you.
Probably this helps someone to clear his questions also.
I paste the code here and a link to download it directly.
ftp://ftp.pilarkto.net/pub/sogo-backup
The important thing is, that the script is expecting a "root-Folder":
/home/sogo/Backup, which is automaticly created.
I hope you enjoy.
Best Regards
Philipp
- PILARKTO.NET -
-------
#! /bin/sh
## Created by PILARKTO.NET - PvSA
## PvSA, 19.4.10
## PvSA, 28.3.2011
## PvSA, 9.6.2011: for all
## PvSA, 6.7.2011: su und Debug-Info
## DEBUG
#set -x
DATE="`date +'%Y%m%d_%H%M%S'`"
#STOOL="/usr/GNUstep/System/Tools/Admin/sogo-tool"
# Changed after upgrade to 1.3.9
STOOL="/usr/sbin/sogo-tool"
mdir -p /home/sogo/Backup
cd /home/sogo/Backup
mkdir tmp_$DATE
chown sogo:sogo tmp_$DATE
chmod -R 770 tmp_$DATE
cd tmp_$DATE
if [ `whoami` = "sogo" ]; then
if [ "$1" = "-i" ]; then
$STOOL -v backup ./ ALL
else
$STOOL backup ./ ALL >> output 2>&1
fi
else
if [ "$1" = "-i" ]; then
su sogo -c "$STOOL -v backup ./ ALL"
else
su sogo -c "$STOOL backup ./ ALL" >> output 2>&1
fi
fi
#su sogo -c "sogo-tool backup ./ ALL" > /dev/null 2>&1
#echo "Exit-Code: $?"
#exit 1
if [ "$?" != "0" ];then
echo "!!!!!"
echo "Error: Backing up with sogo-tool failed"
echo ""
cat output
else
mkdir -p ../STORE/$DATE
chmod -R 770 ../STORE/$DATE
mv * ../STORE/$DATE/
fi
cd ..
rm -rf tmp_$DATE
------
--
users@sogo.nu
https://inverse.ca/sogo/lists