- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- redirecting output/error of a background job start...
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-09-2007 03:25 AM
07-09-2007 03:25 AM
here is the script1:
--script1 starts----
-----------------
---doing its own processing-----
---doing its own processing-----
ksh script2 >& log2 &
---script1 stops------
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 03:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 03:45 AM
07-09-2007 03:45 AM
Re: redirecting output/error of a background job started from a script file
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 03:58 AM
07-09-2007 03:58 AM
Re: redirecting output/error of a background job started from a script file
what if you execute it in a subshell:
$(script2 > logfile2 2>&1) &
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 04:32 AM
07-09-2007 04:32 AM
Re: redirecting output/error of a background job started from a script file
script2 > logfile 2>&1
>This is not working and logs are still going to parents log file.
I can't see how it does that unless script2 is tricky. What's in that file? Do you see log1 there? Unless there is a redirect on every line, the only way to redirect inside the script is to do it on an exec line:
exec > log1 2>&1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 04:51 AM
07-09-2007 04:51 AM
Re: redirecting output/error of a background job started from a script file
my additional question is, if 'script1' is written in posix shell syntax or if its csh syntax. In a C-compatible shell, doing something like this
prompt: echo $SHELL
/bin/tcsh
prompt: ls /tmp /notexiting >& ~/tmp/out&
will produce output on stderr like
[1] 24483
[1] Exit 2 ls /tmp >& ~/tmp/out
but the file ~/tmp/out will contain both stdout and stderr of the above command.
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 05:09 AM
07-09-2007 05:09 AM
Re: redirecting output/error of a background job started from a script file
there was a redirection in script2 itself which was causing this problem and it was hidden somwhere in the big script file.
Thanks all for your prompt reply.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2007 06:04 PM
07-09-2007 06:04 PM
Re: redirecting output/error of a background job started from a script file
http://forums1.itrc.hp.com/service/forums/helptips.do?#33