LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 11-11-2009, 07:35 PM   #1
kb2tfa
Member
 
Registered: Oct 2006
Location: New Jersey
Distribution: CentOS
Posts: 175

Rep: Reputation: 18
bash backup


I need a fresh set of eyes. it's got to be simple but im missing it.
here is the script I'm using


#!/bin/bash
today=$(date '+%d_%m_%y')
echo "* Performing domain backup..."
tar czf /home/data/backup/example.com_"$today".tar.gz -C / home/domains/example.com/
# Remove backups older than 7 days:
MaxFileAge=7
find /home/data/backup/ -name '*.gz' -type f -mtime +$MaxFileAge -exec rm -f {} \;
echo "* Backed up..."

Here is what I get from the term


* Performing domain backup...
tar: home/domains/example.com/: Cannot stat: Permission denied
tar: /home/data/backup/example.com_11_11_09.tar.gz: Cannot open: Permission denied
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
find: /home/data/backup/: Permission denied

Permissions on the /home/data/backup are chmod 777
for security i altered the paths here. but are correct
do I have to change the permissions on my domain?

Last edited by kb2tfa; 11-11-2009 at 09:27 PM.
 
Old 11-12-2009, 02:35 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by kb2tfa View Post
I need a fresh set of eyes. it's got to be simple but im missing it.
here is the script I'm using


#!/bin/bash
today=$(date '+%d_%m_%y')
echo "* Performing domain backup..."
tar czf /home/data/backup/example.com_"$today".tar.gz -C / home/domains/example.com/
# Remove backups older than 7 days:
MaxFileAge=7
find /home/data/backup/ -name '*.gz' -type f -mtime +$MaxFileAge -exec rm -f {} \;
echo "* Backed up..."

Here is what I get from the term


* Performing domain backup...
tar: home/domains/example.com/: Cannot stat: Permission denied
tar: /home/data/backup/example.com_11_11_09.tar.gz: Cannot open: Permission denied
tar: Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error exit delayed from previous errors
find: /home/data/backup/: Permission denied

Permissions on the /home/data/backup are chmod 777
for security i altered the paths here. but are correct
do I have to change the permissions on my domain?

you need correct permissions on example.com also.
 
Old 11-12-2009, 04:10 AM   #3
fotoguy
Senior Member
 
Registered: Mar 2003
Location: Brisbane Queensland Australia
Distribution: Custom Debian Live ISO's
Posts: 1,291

Rep: Reputation: 62
Also check permissions on /home/data, if you don't have the right permissions on this directory, then you wont have on any directory underneath it.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash Backup Script Help..............! Greenberet88x Programming 5 09-24-2009 07:17 AM
Bash - backup script - need help with my if-then-else :D fruitwerks Programming 12 04-11-2009 01:34 PM
Need help with a bash script that does a backup jamtech Programming 8 06-07-2007 11:36 PM
bash help with backup Paxmaster Linux - General 3 02-08-2006 02:09 PM
Backup script in bash gauge73 Programming 13 10-17-2005 06:25 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:17 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration