LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   tar backup script error! (https://www.linuxquestions.org/questions/linux-newbie-8/tar-backup-script-error-766128/)

windstory 11-02-2009 01:17 AM

tar backup script error!
 
This is a tar backup script for full backup.

Code:

#!/bin/bash
DATE=`date +"%Y%m%d"`
BACKUP_DIR=/_work/_backup
SOURCE_DIR=/var/www/html/dm

tar -g ${BACKUP_DIR}/html_full_bak_${DATE}.list -W zcvpf ${BACKUP_DIR}/html_full_bak_${DATE}.tgz ${SOURCE_DIR}/ --exclude ${SOURCE_DIR}/data

And the result is here.
Quote:

[root:localhost:~/backup_script]# ./full_backup.sh
tar: You must specify one of the `-Acdtrux' options
Try `tar --help' or `tar --usage' for more information.

Any help would be appreciated.

linuxlover.chaitanya 11-02-2009 01:20 AM

If you are creating a new tar then you have to use -c option. See man tar for more option.

windstory 11-02-2009 01:29 AM

Quote:

Originally Posted by linuxlover.chaitanya (Post 3740807)
If you are creating a new tar then you have to use -c option. See man tar for more option.

I used "zcvpf" option. As you can see, "c" is included. Do I write "czvpf"?

chrism01 11-02-2009 01:37 AM

1. One of these must be the first option
Quote:

tar: You must specify one of the `-Acdtrux' options
2. -g is GNU incremental backup, but your naming convention suggests a full backup....

windstory 11-02-2009 02:52 AM

Quote:

Originally Posted by chrism01 (Post 3740820)
1. One of these must be the first option

2. -g is GNU incremental backup, but your naming convention suggests a full backup....

Thanks a lot.
I misunderstood it.


All times are GMT -5. The time now is 05:10 AM.