- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Message redirection
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
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
11-20-2002 02:29 AM
11-20-2002 02:29 AM
Message redirection
I'm running an application, it prints lot of printf statements on the terminal, i want to redirect all of the messages to a log file,
i tried doing this using "command > lofile 2>&1", this doesnt work, but the same command works for all unix commands. Is there any other way to capture the messages
regards
chakri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 02:37 AM
11-20-2002 02:37 AM
Re: Message redirection
command | tee -a logfile
or
script logfile
command
The script option may be preferable, as this also captures any user keystrokes involved during the process.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 02:54 AM
11-20-2002 02:54 AM
Re: Message redirection
# script
when you've finished you do a CTRL+D to end the log file. You can then cat, more, print or do whatever with the logfile.
Chuck J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 03:02 AM
11-20-2002 03:02 AM
Re: Message redirection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 03:02 AM
11-20-2002 03:02 AM
Re: Message redirection
tee is also working,, the program is a C program, with lot of printf statements, script works, but the problem with script is i can see the log only after closing the program,
Is there anyway i can get the log messages without closing the application
regards
chakri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 03:21 AM
11-20-2002 03:21 AM
Re: Message redirection
# tail -f logfile
This will update whenever the logfile gets written to.
Don't forget to assign us points please :-)
Chuck J
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 03:26 AM
11-20-2002 03:26 AM
Re: Message redirection
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-20-2002 07:16 AM
11-20-2002 07:16 AM
Re: Message redirection
Here's a guess as to why "this doesnt work, but the same command works for all unix commands".
The application has redirected stdout to the tty device, effectively over-riding what you are attempting with "command >lofile 2>&1".
Check with the application developer to see if that's the case.
Consider the following simple test...
# cat script
#!/usr/bin/sh
echo first message
TTY=$(tty)
echo second message >$TTY
# ./script
first message
second message
# ll
total 2
-rwx------ 1 root sys 57 Nov 20 10:07 script
# ./script >out
second message
# ll
total 4
-rw-r--r-- 1 root sys 14 Nov 20 10:07 out
-rwx------ 1 root sys 57 Nov 20 10:07 script
# cat out
first message
Darrell