Re: [Ssh-sftp-perl-users] Executing Command FIles (KSH) not Simply One-line Commands
Brought to you by:
dbrobins
From: Gurunath G. <gur...@ya...> - 2006-04-14 15:07:26
|
> I'm running into a situation here where I need to connect to remote > servers using this module and be able to execute kron shell file commands > i.e. .ksh. The idea here is to be able to do it while these ksh files are > residing locally where the perl code is run and not on the remote servers. > This is to centralized the code all in one location. > - Can this be done? > - If not, can any one suggest workarounds or other solutions? > - How do admins manage the code that needs to run on 100's of remote > servers ? > >Its pretty simple, load the entire shell file into a scalar variable, and >run that as a command over the channel. If you use return codes to check >the result its even more trivial as Net::SSH2 and/or Net::SSH::Perl gives >you the return code of the channel. >Hope that helps. >Bryan >http://sourceforge.net/projects/rover I think loading entire script in single variable is not a good idea. Its difficult for debugging. You will not know where is it going wrong. -Gurunath --------------------------------- Love cheap thrills? Enjoy PC-to-Phone calls to 30+ countries for just 2¢/min with Yahoo! Messenger with Voice. |