8 Replies Latest reply on Apr 23, 2005 5:54 PM by Wilson Northrup

    Capture output from runcmd

      After adding the BL agent to a group of servers, I wanted to do a quick check to verify they were licensed properly. To do this, I ran:


      runcmd -p 20 -V -f /u/tmp/servers_job2.txt -e agentinfo |grep -i expire


      Nothing fancy and it gives me what I want. I can pipe this to a local file with this:


      runcmd -p 20 -V -f /u/tmp/servers_job2.txt -e agentinfo |grep -i expire > /c/temp/out.txt


      but ideally, i would like to write back to the /u/tmp/ directory and save my output there, and as such, I tried:


      runcmd -p 20 -V -f /u/tmp/servers_job2.txt -e agentinfo |grep -i expire > /u/tmp/out.txt


      but instead of a new file on /u/tmp/, this error appears:

      "Unable to create file /u/tmp/out3.txt: No such file or directory" appears.



      Some background:

      Running CM on Windows & ran "NSH HERE" to start the nsh session. cd to //@ and /u is visible in all the ways one would expect. The /u is actually a U: for a the windows client running CM, and U: is a mapped network drive where my files are kept.


      After cd //@, both /c and /u seem to behave as local devices in other nsh aspects. Anyone have a solution?

        • 1. Re: Capture output from runcmd

          I don't know the exact behaviour of runcmd, in that I don't know if the command is executed within NSH as Administrator or by the rscd service as SYSTEM, but this may be an issue with the level of network access permitted to the SYSTEM account - i.e, read only.

          • 2. Re: Capture output from runcmd

            Not an answer to the question, but an idea for an avenue of investigation.

            • 3. Re: Capture output from runcmd

              Are you trying to put the file on a drive on the local severs (i.e. running CM) or on each remote server listed in servers_job2.txt?


              It seems that the /u drive is valid as seen from your "list of hosts" input file. It just seems that the redirection did not work.


              Did you try to just do a

              host% touch /u/tmp/out.txt

              and see what happens? Also, after you do the "NSH Here" I'm not sure what you did to before the runcmd was run. I tried it as follows and got it to work

              host% cd
              cmhost% runcmd ....


              • 4. Re: Capture output from runcmd

                In a windows environment, shared resources are mapped as drive letters for collaboration, etc. In my case, I'm using a U:\.... so in windows:


                net use U:


                Once dong that my local computer has a local hard disk of C:\ and a network drive of U:\


                NSH allows me to cd //@, then cd /u/tmp.


                Finally, getting back to the question, I'd like to run a runcmd script, and instead of writing the output to my local context of /c/tmp I'd like to write to my local context of /u/tmp.



                runcmd | grep something > /u/tmp/out.txt



                it doesn't seem to work with the /u/tmp but works fine if I use /c/tmp. Note that this writes to my local context of /c/tmp and not on a managed host /c/tmp.

                • 5. Re: Capture output from runcmd

                  That's almost exactly what my old unicenter script did; map a drive to a network share, cd to that share then attempt to write a file there.


                  It turned out that the problem was the unicenter service was running as SYSTEM, so the scheduled job was too and SYSTEM didn't have write access to the network.


                  This was a very long time ago (7-8 years), but it still could be the case in this case.

                  • 6. Re: Capture output from runcmd

                    Wilson, it looks like a problem writing output to the U: drive (/u/tmp)


                    Try running something simple redirected to /u/tmp:


                    echo test > /u/tmp/out.txt

                    • 7. Re: Capture output from runcmd

                      Update: Andrew and I worked offline a bit on this. As it turns out, this problem only seems to happen with my terminal server session, and not when when running directly from my local client. More details as they come.

                      • 8. Re: Capture output from runcmd

                        Never was able to figure this out. it only happens when running NSH from within the terminal server enviornment.


                        if /c is local and /u is a network drive, I can cd to /u, I can make directories under /u but I can not touch file.txt


                        Bottom line is that I can't create any filse on a windows network share, and it's not a permissions issue (reacall that I can create directories).