hi
I'm dabbling with shell scripting a little and trying to get a backup script running on FreeBSD.
Illegal variable name? There are several variables in my script; not the most verbose error message then.
Another angle I've tried this from is:
I have the following shells on my system:
The original tutorial is from: http://theme.fm/2011/06/a-shell-script-for-a-complete-wordpress-backup-4/
Why would tar() work with --transform on Ubuntu and not on FreeBSD?
Can anyone throw me a bone?
Thanks in advance.
I'm dabbling with shell scripting a little and trying to get a backup script running on FreeBSD.
Code:
#!/bin/csh
NOW=$(date +"%Y-%m-%d-%H%M")
FILE="example.com.$NOW.tar"
BACKUP_DIR="/usr/home/andy/backups"
WWW_DIR="/var/www/"
DB_USER="user"
DB_PASS="pass"
DB_NAME="dbname"
DB_FILE="example.com.$NOW.sql"
WWW_TRANSFORM='s,^var/www,public_html,'
DB_TRANSFORM='s,^usr/home/andy/backups,database,'
tar -cvf $BACKUP_DIR/$FILE --transform $WWW_TRANSFORM $WWW_DIR
mysqldump -u$DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/$DB_FILE
tar --append --file=$BACKUP_DIR/$FILE --transform $DB_TRANSFORM $BACKUP_DIR/$DB_FILE
rm $BACKUP_DIR/$DB_FILE
gzip -9 $BACKUP_DIR/$FILE
/bin/csh backup.script
Code:
Illegal variable name.
Another angle I've tried this from is:
/usr/local/bin/bash backup.script
and adjusting the shebang accordingly:
Code:
tar: Option --transform is not supported
I have the following shells on my system:
Code:
/bin/sh
/bin/csh
/bin/tcsh
/usr/local/bin/bash
/usr/local/bin/rbash
The original tutorial is from: http://theme.fm/2011/06/a-shell-script-for-a-complete-wordpress-backup-4/
Why would tar() work with --transform on Ubuntu and not on FreeBSD?
Can anyone throw me a bone?
Thanks in advance.