Results 1 to 3 of 3
|
Enjoy an ad free experience by logging in. Not a member yet? Register.
|
|
-
10-19-2011 #1
- Join Date
- Aug 2011
- Posts
- 11
backup script help, sending a tar file to a remote server
This is to be part of a cronjob script.
Code:echo "tar backup directory ".$b tar zpcf - /home/erind/socprojects_backups/$b | ssh erind at serveripaddress "cat > socProjects.$b.tar"
Secondly, since the cronjob is ran as root, I need to change the ownership and permissions of the tar file to erind, how can I do this if I immediately have the tar file sent to the backup server. Previously my script was just creating a tar file to save on the same server so I had this following the creation of the tar:
chown erin socProjects.$b.tar
chmod u+rw socProjects.$b.tar
Thanks for any help,
Erin
-
10-19-2011 #2
- Join Date
- May 2011
- Posts
- 4,353
The warning about removing leading / is not bad. It just means that you have to be sure to specify that path when you are untarring, if you wish it to get put back in the same place, e.g.:
Code:tar -C / -xf /path/to/backup.tar
Code:ssh erind at serveripaddress "chown erin socProjects.$b.tar;chmod u+rw socProjects.$b.tar"
Last edited by atreyu; 10-19-2011 at 03:11 PM. Reason: wait...
-
10-19-2011 #3
- Join Date
- Aug 2011
- Posts
- 11
thanks for your help atreyu, im still working out problems with the script but what you said about file ownership makes sense