- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Adding Data to an Existing File
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
Forums
Discussions
Discussions
Discussions
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
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
07-31-2005 03:10 AM
07-31-2005 03:10 AM
Adding Data to an Existing File
I am in the process of creating a script that will run the vgdisplay utility on each logical volume on our vg00 volume group and pipe it to a file. The file, in turn, will be e-mailed to the system administrator. I would like to have the information of all logical volumes generated to one file rather than separate ones. How would I go about having each logical volume added to a single file? Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2005 03:24 AM
07-31-2005 03:24 AM
Re: Adding Data to an Existing File
vgdisplay -v /dev/vg00 >> /tmp/file.out
vgdosplay -v /dev/vg01 >> /tmp/file.out
> will overwrite a file
>> appends to a file
If you were running a bunch of commands manually you can use script -a /tmp/file.out
to log all of your screen output.
you could even do a for loop script
for i in `cat /tmp/vglist`
do
vgdisplay -v /dev/vg$i >> /tmp/file.out
done
# now send file to yourself
cat /tmp/file.out |mailx -s "your subject" you@yourmail.com
In the vglist file you would put the volume groups you want your command ran against.
example in vglist file follows
01
02
03
and so on :)
Hope this was a helpful answer. The example should do exacly what you wanted.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2005 03:33 AM
07-31-2005 03:33 AM
Re: Adding Data to an Existing File
See Bill's reply which describes how he uses it http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=754241
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2005 06:10 PM
07-31-2005 06:10 PM
Re: Adding Data to an Existing File
# vgdisplay -v /dev/vg00 | mailx -s "vgdisplay information for vg00 from `hostname`"
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2005 06:21 PM
07-31-2005 06:21 PM
Re: Adding Data to an Existing File
(vgdisplay;lvdisplay `bdf | awk '/\/dev\/vg00/ { print $1 }'`) | mailx -s "vgdisplay, lvdisplay for vg00"
To send as a attachment,
(vgdisplay;lvdisplay `bdf | awk '/\/dev\/vg00/ { print $1 }'`) > /tmp/vg_lv_display.log
uuencode /tmp/vg_lv_display.log | mailx -s "vgdisplay, lvdisplay for vg00 `hostname`"
hth.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2005 06:45 PM
07-31-2005 06:45 PM
Re: Adding Data to an Existing File
$ cat script
> /tmp/file # this will truncate the file
for i in `cat /tmp/vglist`
.
.
.
done
-Amit