Operating System - HP-UX
1834431 Members
2184 Online
110067 Solutions
New Discussion

Re: standard output redirect from script

 
njia_1
Trusted Contributor

standard output redirect from script

Hi

I want a osiping running at backgrund all the time but redirect the standard output to a file so I can monitor it.

I tried this

# at now
osiping NSAPs 2>&1 /tmp/osiping.log
crtl D

but it is not working, the osiping is running but I see nothing in that file.

thanks
Nan
3 REPLIES 3
Biswajit Tripathy
Honored Contributor

Re: standard output redirect from script

Try:

osiping NSAPs > /tmp/osiping.log 2>&1

- Biswajit
:-)
Devender Khatana
Honored Contributor

Re: standard output redirect from script

Hi,

Could you try using

osiping NSAPs >/tmp/osiping.log

for only redirecting standard output.

HTH,
Devender
Impossible itself mentions "I m possible"
Muthukumar_5
Honored Contributor

Re: standard output redirect from script

You have to try as,

# osiping NSAPs 1>/tmp/osiping.log 2>&1 &

If you use & you can monitor log file in same terminal.

It will run into background and you can monitor it as,

# tail -f /tmp/osiping.log

Problem in your script is, you are redirecting standard error to standard output but did not redirect standart output to log file.

hth.
Easy to suggest when don't know about the problem!