Stanley
(Starting to like KiXtart)
2004-07-22 09:08 PM
Redirecting SHELL cmd errors

Good afternoon Gentlebeings:
Hope you can help.
Why doesn't this return stdoutput and stderr to the log?
Code:

SHELL "%COMSPEC% /C XCOPY C:\TEST\O\*.* C:\TEST\A\*.* /y /r /v /f /e >>C:\logs\test.log 2>>C:\logs\test.log"


Thanks
Stanley


NTDOCAdministrator
(KiX Master)
2004-07-22 11:09 PM
Re: Redirecting SHELL cmd errors

Hi Stanley,

Your syntax is incorrect for what you're wanting to accomplish. Please review this post which should help you. If you still need assistance further let us know.

COMSPEC Question
http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Board=UBB2&Number=115983


LonkeroAdministrator
(KiX Master Guru)
2004-07-22 11:11 PM
Re: Redirecting SHELL cmd errors

not sure what is wrong in it.
looks fine to me.


Stanley
(Starting to like KiXtart)
2004-07-22 11:29 PM
Re: Redirecting SHELL cmd errors

They error I get is
"The process cannot access the file because it is being used by anther process"
I didn't find anything in the link about redirecting output.
Appreciate the effort though


LonkeroAdministrator
(KiX Master Guru)
2004-07-22 11:30 PM
Re: Redirecting SHELL cmd errors

the error is pretty clear.
kinda like, your log file is opened for explicit writing so it can't be written to.


Stanley
(Starting to like KiXtart)
2004-07-22 11:37 PM
Re: Redirecting SHELL cmd errors

Laziness takes its toll. I did not read all of the links. Found it in the second one.
Code:
  
SHELL "%COMSPEC% /C XCOPY C:\TEST\O\*.* C:\TEST\A\*.* /y /r /v /f /e >>C:\logs\test.log 2>&1"



This did what I wanted. Thanks DOC. Give that man a star.


Les
(KiX Master)
2004-07-23 12:51 AM
Re: Redirecting SHELL cmd errors

What about the guy that wrote the FAQ? Does he not get a star?

Sealeopard
(KiX Master)
2004-07-23 03:18 AM
Re: Redirecting SHELL cmd errors

Just ONE lousy star? What's up with that? Give that being five! And the FAQ Writer as well!

Stanley
(Starting to like KiXtart)
2004-07-23 04:14 PM
Re: Redirecting SHELL cmd errors

Okay Okay Two stars for DOC for pointing me in the right direction and three stars for robvandewoude.com for having the info I needed. Everyone else gets one star for effort.




JochenAdministrator
(KiX Supporter)
2004-07-23 04:21 PM
Re: Redirecting SHELL cmd errors

hmmm ... the rating system has to be understand diferently.

->Rate a user ONE star (*) only if you are really pissed off by his reply

->Forget all ratings in between as they really obfuscate the overall reflection of the rating situation of this User

->Rate 5 stars (*****) if you are satisfied with the answer(s); Like 'Wow, this guy really saved me half a day of work or even better my job'

hth


Stanley
(Starting to like KiXtart)
2004-07-23 04:28 PM
Re: Redirecting SHELL cmd errors

Mea Culpa Mea Culpa Mea Maxima Culpa
Five stars for everyone
Laziness strikes again.
Sorry Stanley


Stanley
(Starting to like KiXtart)
2004-07-23 04:32 PM
Re: Redirecting SHELL cmd errors

Mea Culpa Mea Culpa Mea Maxima Culpa
or something like that. I apologize if I have offended anyone . Now that I understand the rating system.
Five stars for everyone.
Thanks for setting me straight.


LonkeroAdministrator
(KiX Master Guru)
2004-07-23 04:50 PM
Re: Redirecting SHELL cmd errors

no big deal.
but it feels little painfull if you help someone and get your rating lowered by that


Les
(KiX Master)
2004-07-23 04:56 PM
Re: Redirecting SHELL cmd errors

Quote:

three stars for robvandewoude.com




and I thought you gleaned the info from my FAQ.

Not quite everything you wanted to know about RUN and SHELL

Guess I am not worthy of your vote then.

BTW, somone gave me 1 lousy star, knocking down the 5 I had to the current 4. If only I knew who...


Stanley
(Starting to like KiXtart)
2004-07-23 04:57 PM
Re: Redirecting SHELL cmd errors

I apologize again, but back to the original issue.
Is there a way to return any errors to the Kix script?
Code:
  
$ret = SHELL "%COMSPEC% /C XCOPY C:\test\a\$filename C:\test\o\*.* /y /e /f /v /r >>C:\_test\test.log 2>&1"



kicks up an "ERROR: Error in expression.!"


Les
(KiX Master)
2004-07-23 05:00 PM
Re: Redirecting SHELL cmd errors

Are you talking about the error text or ERRORLEVEL? ERRORLEVEL is returned as @Error. There are various Pipe() UDFs that can return SHELLed output back to KiX.

ShawnAdministrator
(KiX Supporter)
2004-07-23 05:01 PM
Re: Redirecting SHELL cmd errors

SHELL doesn't return a value. Check @ERROR to find the return code from programs run through SHELL (i'm trying for a five-star rating too) :0)

-Shawn


Stanley
(Starting to like KiXtart)
2004-07-23 08:18 PM
Re: Redirecting SHELL cmd errors

Actually I am trying to get a return from any shell command. I did realize that @ERROR returns correctly, but what i am trying for is this.
I am transferring files via FTP and when I run the SHELL to run the FTP session I was hoping to be able to get the results into the KIX script so I can update an inhouse job monitoring system as to whether the files were actually FTP'd or not.
Shawn:
I have been monitoring this board for a while now , but just joined recently and from your past responses to other peoples questions I would say you deserve five stars.


LonkeroAdministrator
(KiX Master Guru)
2004-07-23 08:33 PM
Re: Redirecting SHELL cmd errors

check the udf library for ftpGet() (see my sig for alphabetical listing of all those 480+ udfs)

Stanley
(Starting to like KiXtart)
2004-07-23 08:46 PM
Re: Redirecting SHELL cmd errors

Thank you Lonk



Les
(KiX Master)
2004-07-23 08:57 PM
Re: Redirecting SHELL cmd errors

Quote:

(i'm trying for a five-star rating too)



You basta already have 5. This basta must have pissed off too many ppl, stuck at 4.


Chris S.
(MM club member)
2004-07-23 09:27 PM
Re: Redirecting SHELL cmd errors

Quote:

This basta must have pissed off too many ppl, stuck at 4.




Ja, me too. Though I think I know who I pissed off.


LonkeroAdministrator
(KiX Master Guru)
2004-07-23 10:00 PM
Re: Redirecting SHELL cmd errors

me?
I just rated you 5 and it had no effect whatsoever.


NTDOCAdministrator
(KiX Master)
2004-07-23 10:33 PM
Re: Redirecting SHELL cmd errors

I did on the old board and did here as well and same. No change.

LonkeroAdministrator
(KiX Master Guru)
2004-07-23 11:01 PM
Re: Redirecting SHELL cmd errors

on the old board the pure rating is visible easy, how we know now what's the actual rating?
4.71 again?


New Mexico Mark
(Hey THIS is FUN)
2004-07-24 12:16 AM
Re: Redirecting SHELL cmd errors

In my group at work, our tacit motto is that anyone who hasn't made any mistakes is seriously underworked. Likewise, I would view an "almost perfect" rating as the highest praise. If you haven't worked with enough people to piss at least one or two off, you're probably just coasting. <g> (Hence my five-star rating when I had one -- major coasting going on here!)

LonkeroAdministrator
(KiX Master Guru)
2004-07-24 12:20 AM
Re: Redirecting SHELL cmd errors

so, now you not coasting?