- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- renaming / as /root.bak while taking vxdump backup
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 12:46 AM
тАО12-09-2008 12:46 AM
for ex:-
/var --> /var.bak
/stand --> /stand.bak
and so on
Below is my script:-
===>
set -vx
TAPE=/backup/networker_db_backup/os_app
HOST=`hostname`
FILESYSTEMS=`cat /test/filesystems_to_backup_V3`
echo "STARTING BACKUP OF $HOST `date`"
cd /
for i in $FILESYSTEMS
do
echo "STARTING BACKUP OF $i `date`"
/usr/sbin/vxdump -0 -u -b 128 -B 200g -f ${TAPE}${i}.bak $i 2>&1
if [ $? -gt 0 ] ; then
echo "BACKUP FAILED FOR $i `date`"
exit 1
else
echo "BACKUP COMPLETED FOR $i `date`"
fi
done
echo "END OF BACKUP SCRIPT"
====>
The problem is it backs / as:
/ --> .bak
and want it to be backed as below:
/ --> /root.bak
if I repalce the / with root in the file list it won't back the / filesytem. Kindly assist with your inputs.
Thanking you in advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 12:56 AM
тАО12-09-2008 12:56 AM
Re: renaming / as /root.bak while taking vxdump backup
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 12:58 AM
тАО12-09-2008 12:58 AM
Re: renaming / as /root.bak while taking vxdump backup
${i}.bak ---> this part does that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 02:12 AM
тАО12-09-2008 02:12 AM
Solutiontry this:
...
echo "STARTING BACKUP OF $i `date`"
j=${i#/}
/usr/sbin/vxdump -0 -u -b 128 -B 200g -f ${TAPE} /${j:-root}}.bak $i 2>&1
if [ $? -gt 0 ] ; then
...
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 03:03 AM
тАО12-09-2008 03:03 AM
Re: renaming / as /root.bak while taking vxdump backup
I pressume this will only back / area. But what I intend to do is back up all the files in $FILESYSTEMS in for loop.
Currently it is doing so for all the filesystem however it is backing the / as .bak which I need to do as root.bak along with all the other filesystems.
Hope you understood.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 03:45 AM
тАО12-09-2008 03:45 AM
Re: renaming / as /root.bak while taking vxdump backup
Peter's logic will remove the "/" from the name, then if there is nothing left, it will insert "root".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 04:57 AM
тАО12-09-2008 04:57 AM
Re: renaming / as /root.bak while taking vxdump backup
If possible kindly explain the logic.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 05:28 AM
тАО12-09-2008 05:28 AM
Re: renaming / as /root.bak while taking vxdump backup
> To be frank I have not understood the logic.
To see what Peter has done (to solve your problem), run this test script:
# cat ./seehow
#!/usr/bin/sh
for i in / /root /tmp /var
do
j=${i#/}
echo /usr/sbin/vxdump -0 -u -b 128 -B 200g -f ${TAPE} /${j:-root}.bak $i
done
The statement:
j=${i#/}
...examines the 'i' parameter and if it begins with the '/' character, then that character is dropped and the remainder of the character string is assigned to 'j'. Otherwise, the value of 'i' is simply assigned to 'j'.
The experssion:
/${j:-root}.bak
...is of the form:
${parameter:-word}
...which says, if the parameter is set and is nonnull, substitute its value; otherwise, substitute word. Hence, if 'j' is set and not null, use the value of 'j'; otherwise, substitute the string "root".
These techniques are described in the 'sh-posix' manpages under "Parameter Substitution":
http://docs.hp.com/en/B3921-60631/sh-posix.1.html
Regards!
...JRF...
- Tags:
- variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 06:05 AM
тАО12-09-2008 06:05 AM
Re: renaming / as /root.bak while taking vxdump backup
Special thanks to Peter and James.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-09-2008 06:05 AM
тАО12-09-2008 06:05 AM