Page 1 of 1

Create a file (remote) with an agent

Posted: Thu May 15, 2008 2:50 am
by Vini
Hi everyone,
I'd like to know how to make an agent create a file on a remote host via a shell script.
I've already done a little script which should store configuration informations in a specific file, that script works well localy but when i make the RMA execute it, it looks that there is no problem but i don't know where my agent creates my file, i didn't find anything in the main rma folder or in the tmp rma folder.
Do you have any clues please??

Posted: Thu May 15, 2008 3:16 am
by Vini
Well to precise a bit....
I understood that the agent execute my script as a new process on teh remote host so it should create my file where that process is launched...but where??
My script simply do a "touch" command and then add all information i need in it.
Well, i don't know what to add...
Thx for any rely.
Vini

Posted: Thu May 15, 2008 3:27 am
by Vini
Ok, sorry for disturbing, i found i to reslove my problem. I just needed to use complete path (from / i mean).
So now file file is well created where i want and i can now rapatriate it through sftp ^^. Great!!
Thx anyway
Have a nice day
Vini

Posted: Thu May 15, 2008 5:58 am
by KS-Soft Europe
Correct. You should use full path to the file. Glad you managed it to work.
Thank you for your feedback.

Regards,
Max

Posted: Wed Aug 27, 2008 8:49 am
by ataudte
Hello,

I cann't find my mistake.
I created an Action Profile to run external program. It should be executed by an agent (Unix).

Command line:
/usr/bin/echo %Reply_CStyle% >> /opt/hostmonitor/test.txt

Window mode:
SW_HIDE

After status change, there isn't a file in the specified folder. Why?
The RMA runs correctly and executes a lot of shell script tests, but it doesn't run the command of the Action Profile.

Regards,
ataudte

Posted: Wed Aug 27, 2008 9:39 am
by ataudte
APPENDIX

I checked the RMA for Unix on the Server. The rma got the permission to run external program (ExecuteAction=1). I restarted the RMA and the HostMonitor, but the command (/usr/bin/echo %Reply_CStyle% >> /opt/hostmonitor/test58.txt) doesn't make an impact.

Regards,
ataudte

Posted: Wed Aug 27, 2008 12:12 pm
by KS-Soft
That's because output redirection (>>) is processed by command shell. In your case shell is not executed.
I would recommend to create simple script, e.g. /usr/rma/testlog.sh
============
#/bin/sh
/usr/bin/echo $1 >> /opt/hostmonitor/test.txt

============

Then HostMonitor can execute the following command
sh /usr/rma/testlog.sh %Reply_CStyle%

Regards
Alex

Posted: Wed Aug 27, 2008 11:52 pm
by ataudte
Hallo Alex,

thanks a lot!
We tried some other shell commands yesterday and fixed the fault ("... >> ..."). Now we know, how to run an external program via RMA for Unix and it works great :)

Thanks for the trouble,
ataudte

Posted: Thu Aug 28, 2008 10:03 am
by KS-Soft
You are welcome

Regards
Alex