- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Korn scripting question
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
тАО10-26-2006 08:09 PM
тАО10-26-2006 08:09 PM
I'm trying to run the following ....
$ script test.scr
$ ls -1 *.txt
$ exit
$ cat test.scr
... but inside a korn script. So something like :
#/usr/bin/ksh
script test.scr << EOF
ls -1 *.txt
exit
EOF
cat test.scr
This obviously will not work, but does anyone know how I can pass an exit statement to the script process in order for it to terminate?
The script is more complicated than the above (in case someone asks why I'm using the 'script' binary), but I cannot redirect the following to a file :
find /app/oracle/admin/udlgrid1/udump -name "*.trc" -mtime 2 -exec /usr/sbin/fuser {} \; | grep : | awk -F":" '{print $2;next}'
my attempt using :
find /app/oracle/admin/udlgrid1/udump -name "*.trc" -mtime 2 -exec /usr/sbin/fuser {} \; | grep : | awk -F":" '{print $2;next}' > tracefiles.txt
does not seem to work
any other options appreciated
thanks in advance
John
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 09:58 PM
тАО10-26-2006 09:58 PM
SolutionI would suggest building a two script system with an exit at the end of the second script.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-26-2006 11:13 PM
тАО10-26-2006 11:13 PM
Re: Korn scripting question
Try appending 2>/dev/null before piping into grep or awk.
I'm not quite sure if I got what your intentions are?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2006 12:19 AM
тАО10-27-2006 12:19 AM
Re: Korn scripting question
I'm also not sure of your intentions. Oracle trace files are generated when a background process or user process encounters an exception. I don't see why any process would have a trace file open after it has been written to initially.
In any event, you may want to give 'lsof' a shot, although I personally find it very flaky under HP-UX.
By the way, the format of a background trace filename is:
sid_proc_ospid.trc
where
sid = Oracle instance name
proc = Oracle bg thread name
ospid = HP-UX pid
As you can see, the pid of the offending process is embedded in the filename. This is also true for user thread trace files, although the naming format is a bit different.
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2006 12:29 AM
тАО10-27-2006 12:29 AM
Re: Korn scripting question
I'll go with the two script option
many thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2006 12:41 AM
тАО10-27-2006 12:41 AM
Re: Korn scripting question
Use the "exec" command rather "script"
Sample:
# begin script
exec > /tmp/sample.txt
find /app/oracle/admin/....
...
# end escript
rgs,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-27-2006 03:20 AM
тАО10-27-2006 03:20 AM
Re: Korn scripting question
if you want to have the stderr as well in the file - what I assume - modify the solution of rgs to:
exec >/tmp/listing 2>&1
commands...
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-29-2006 06:52 PM
тАО10-29-2006 06:52 PM
Re: Korn scripting question
you could use the '{}' way:
#/usr/bin/ksh
{
ls -1 *.txt
exit
} >test.src
cat test.scr
HTH,
Art