KS-Soft. Network Management Solutions
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister    ProfileProfile    Log inLog in 

Create a file (remote) with an agent

 
Post new topic   Reply to topic    KS-Soft Forum Index -> RMA for UNIX
View previous topic :: View next topic  
Author Message
Vini



Joined: 23 Apr 2008
Posts: 12

PostPosted: Thu May 15, 2008 2:50 am    Post subject: Create a file (remote) with an agent Reply with quote

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
View user's profile Send private message Send e-mail
Vini



Joined: 23 Apr 2008
Posts: 12

PostPosted: Thu May 15, 2008 3:16 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
Vini



Joined: 23 Apr 2008
Posts: 12

PostPosted: Thu May 15, 2008 3:27 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail
KS-Soft Europe



Joined: 16 May 2006
Posts: 2833

PostPosted: Thu May 15, 2008 5:58 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
ataudte



Joined: 23 Apr 2008
Posts: 28
Location: FFM, Germany

PostPosted: Wed Aug 27, 2008 8:49 am    Post subject: Reply with quote

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
View user's profile Send private message
ataudte



Joined: 23 Apr 2008
Posts: 28
Location: FFM, Germany

PostPosted: Wed Aug 27, 2008 9:39 am    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 11782
Location: USA

PostPosted: Wed Aug 27, 2008 12:12 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
ataudte



Joined: 23 Apr 2008
Posts: 28
Location: FFM, Germany

PostPosted: Wed Aug 27, 2008 11:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
KS-Soft



Joined: 03 Apr 2002
Posts: 11782
Location: USA

PostPosted: Thu Aug 28, 2008 10:03 am    Post subject: Reply with quote

You are welcome

Regards
Alex
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    KS-Soft Forum Index -> RMA for UNIX All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

KS-Soft Forum Index