Did you remove the "z" on purpose? Your backups are bound to take up a lot more space without compression.
The capital "P" option will indeed disable the function that usually strips leading slashes, hence removing the message. As for the message (which is not an error message), it will only appear if the $SRCDIR variable starts with a slash. This command would not produce any output at all:
Code:
bob@server:~# tar -czpf mybackup.tgz *
bob@server:~#
...while the following command backs up the same files using an absolute path (starting with a "/"), which triggers the
tar function in question:
Code:
bob@server:~# tar -czpf mybackup.tgz /home/bob/*
tar: Removing leading `/' from member names
bob@server:~#
...and finally, with the "P" parameter all is silent again, but the archive will contain absolute paths with can't be restored to an alternate location without a workaround:
Code:
bob@server:~# tar -czpPf mybackup.tgz /home/bob/*
bob@server:~#
If you're running this script as a cron job and are getting tired of receiving mails from cron every time the job is run, adding "2> /dev/null" to the crontab entry is probably a better idea. A backup script should do its own error checking anyway.