View previous topic :: View next topic |
Author |
Message |
Vini
Joined: 23 Apr 2008 Posts: 12
|
Posted: Thu May 15, 2008 2:50 am Post subject: Create a file (remote) with an agent |
|
|
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?? |
|
Back to top |
|
 |
Vini
Joined: 23 Apr 2008 Posts: 12
|
Posted: Thu May 15, 2008 3:16 am Post subject: |
|
|
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 |
|
Back to top |
|
 |
Vini
Joined: 23 Apr 2008 Posts: 12
|
Posted: Thu May 15, 2008 3:27 am Post subject: |
|
|
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 |
|
Back to top |
|
 |
KS-Soft Europe
Joined: 16 May 2006 Posts: 2832
|
Posted: Thu May 15, 2008 5:58 am Post subject: |
|
|
Correct. You should use full path to the file. Glad you managed it to work.
Thank you for your feedback.
Regards,
Max |
|
Back to top |
|
 |
ataudte
Joined: 23 Apr 2008 Posts: 28 Location: FFM, Germany
|
Posted: Wed Aug 27, 2008 8:49 am Post subject: |
|
|
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 |
|
Back to top |
|
 |
ataudte
Joined: 23 Apr 2008 Posts: 28 Location: FFM, Germany
|
Posted: Wed Aug 27, 2008 9:39 am Post subject: |
|
|
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 |
|
Back to top |
|
 |
KS-Soft
Joined: 03 Apr 2002 Posts: 12649 Location: USA
|
Posted: Wed Aug 27, 2008 12:12 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
ataudte
Joined: 23 Apr 2008 Posts: 28 Location: FFM, Germany
|
Posted: Wed Aug 27, 2008 11:52 pm Post subject: |
|
|
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 |
|
Back to top |
|
 |
KS-Soft
Joined: 03 Apr 2002 Posts: 12649 Location: USA
|
Posted: Thu Aug 28, 2008 10:03 am Post subject: |
|
|
You are welcome
Regards
Alex |
|
Back to top |
|
 |
|