Is there any module in Strawberry PERL to download/upload files using SFTP protocol from a Windows host? - sftp

I am trying to download the files from a remote MFT server using Strawberry perl but I do not get any output or error on the screen.
I am using Strawberry PERL on a windows machine.
I have tried using Net::SFTP::Foreign module but could not resolve the issue.
use strict;
use warnings;
use File::Slurp qw(read_file write_file);
use Getopt::Long;
use Log::Log4perl qw(:easy);
use Net::SFTP::Foreign;
use Net::SFTP::Foreign::Backend::Net_SSH2;
my $sftp = Net::SFTP::Foreign->new($host,
backend => 'Net_SSH2',
username => $user,
password => $pass);
$sftp->error and
die "Unable to stablish SFTP connection: ". $sftp->error;
my $ls = $sftp->ls("$MFTDIR");
print $ls;
I am expecting to see the list of files on the server to start with. But it is not showing anything.
Next step would be to download the files.

Related

XQuery process:execute how to execute external programm?

I am running exist-db on windows and would like to execute an external windows program.
This works inside the normal windows shell:
C:\path\to\webGLRtiMaker.exe C:\path\to\ImageFile.rti -q 90
And I would like to execute the same program from my xquery script (I have uploaded all the needed files according to my specified paths to my exist-db):
xquery version '3.1';
import module namespace process="http://exist-db.org/xquery/process" at "java:org.exist.xquery.modules.process.ProcessModule";
declare variable $options := '<options>
<workingDir>/db/apps/test-project/images</workingDir>
<stdin><line>/db/apps/execute-test/images/image1.rti -q 90</line></stdin>
</options>';
(:process:execute($webRtiMaker, <options/>):)
process:execute('/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe', $options)
Even if I only execute the program without parameters (if I execute it inside windows I get the parameters as overview inside the command prompt so I should also receive some kind of output):
process:execute('/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe', <options/>)
But I get the error:
exerr:ERROR An IO error occurred while executing the process /db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe: Cannot run program "/db/apps/execute-test/resources/RTIMaker/webGLRtiMaker.exe": CreateProcess error=2, The System cannot find the file ...
I used this as reference: Execute External Process
What am I doing wrong?
I have not tried this recently, but try the following:
import module namespace process="http://exist-db.org/xquery/process" at "java:org.exist.xquery.modules.process.ProcessModule";
let $cmd := 'C:\path\to\webGLRtiMaker.exe C:\path\to\ImageFile.rti -q 90'
return
<results>{process:execute($cmd, <options/>)}</results>
There is an article at the XQuery WikiBook about it.
Unfortunately it is not possible to start an executable that is stored inside the database. The java API requires direct access to a file on the filesystem, and the '/db/....' path is not.

Asterisk Voip Error : Chan_alsa.so file missing

I am on Ubuntu 16.04 and was setting up asterisk 15.3.0.I am following a beginners guide from hereSet up Asterisk
Asterisk and linphone 4.1 were installed successfully.My Users.conf file looks like this:
[6001]
fullname = Example Bob
secret = 1234
hassip = yes
context = users
host = 192.168.0.129
[6002]
fullname = Example Joe
secret = 1234
hassip = yes
context = users
host = dynamic
and Extensions.conf file:
[users]
exten => 6001,1,Dial(SIP/6001)
exten => 6002,1,Dial(SIP/6002)
When I hit 'sip show peers' on the Asterisk CLI, I get both the users, However when I type 'console dial 6001', it gives me an error saying chan_oss.co is not found.After Searching for sometime, I found out that I am supposed to load chan_alsa.so. But when I try to load 'chan_alsa.so' , I get an error saying:
module 'chan_alsa.so': /usr/lib/asterisk/modules/chan_alsa.so: cannot open shared object file: No such file or directory
I can't find any solution for this , in the directory there is no file called chan_alsa.so
Reason: you have no module chan_alsa.so in your asterisk lib directory(see /etc/asterisk/asterisk.conf
Possible causes:
When you do compilation from source was no alsa-dev or alsa-libs
When you installed via package manager you not installed asterisk-alsa package.

How to read a file that is located on a linux server using R

I have a CSV file and I want to work on it I've tried to read it by using this code
d = read.table( pipe( 'ssh don#140.184.134.189 "cat cluster.csv"' ), header = T )
But I get no result and get this message:
"error in read table"
Without asking about my password.
Also, how do you run an R script fes.r that is located on the same server?
You can first try this, continuing along the lines you are on:
> d <- read.table(pipe('ssh -l don 140.184.134.189 "cat cluster.csv"'))
don#140.184.134.189 password: # type password here
If you don't get prompted for a password, then there is likely a configuration problem with your ssh. Please note that ssh has to be installed and in your $PATH (meaning R can invoke it from anywhere it is running).
If this option doesn't work, then you can try using scp from the RCurl package.
Try the following:
x = scp("140.184.134.189", "cluster.csv", "PASSPHRASE", user="don")
Here you should replace "PASSPHRASE" with the password of your local SSH key.
One other thing to check is whether "cluster.csv" is really the correct path to your file on the remote server. But it seems that you are not even getting this far, so fix the ssh problem first.
Hat tip to this Stack Overflow post for inspiration.
You could take a different approach and install Rstudio server on your remote linux machine.
Rstudio server
You can avoid the password problem by setting up an ssh key pair, and adding your public key to the ~/.ssh/authorized_keys file on the server.
You can see how to run an R script from command line here: Run R script from command line

Not able to start Websphere application Server 8.0 in Rational application developer 8

On the console.. I get the following -
Usage: java [-options] class [args...]
(to execute a class)
or java [-jar] [-options] jarfile [args...]
(to execute a jar file)
where options include:
-cp -classpath <directories and zip/jar files separated by ;>
set search path for application classes and resources
-D<name>=<value>
set a system property
-verbose[:class|gc|jni]
enable verbose output
-version print product version
-version:<value>
require the specified version to run
-showversion print product version and continue
-jre-restrict-search | -no-jre-restrict-search
include/exclude user private JREs in the version search
-agentlib:<libname>[=<options>]
load native agent library <libname>, e.g. -agentlib:hprof
see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
load Java programming language agent, see java.lang.instrument
-? -help print this help message
-X print help on non-standard options
-splash:<imagepath> show splash screen with specified image
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
enable assertions
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
disable assertions
-esa | -enablesystemassertions
enable system assertions
-dsa | -disablesystemassertions
disable system assertions
Eventually the server doesn't start and gets stopped after time-out. The Server was working fine. However, I wanted to restart it. I stopped the server completely and tried starting it. Since then I am facing this issue.
You can check the script that is getting executed when you right click and start the server.
Check if there are any unwanted entries in the java options which does not confirm to the java command line.

Installing an MSP using Powershell works on the local machine, fails remotely. Why?

I need some Powershell advice.
I need to install an application's MSP update file on multiple Win08r2 servers. If I run these commands locally, within the target machine's PS window, it does exactly what I want it to:
$command = 'msiexec.exe /p "c:\test\My Application Update 01.msp" REBOOTPROMPT=S /qb!'
invoke-wmimethod -path win32_process -name create -argumentlist $command
The file being executed is located on the target machine
If I remotely connect to the machine, and execute the two commands, it opens two x64 msiexec.exe process, and one msiexec.exe *32 process, and just sits there.
If I restart the server, it doesn't show that the update was installed, so I don't think it's a timing thing.
I've tried creating and remotely executing a PS1 file with the two lines, but that seems to do the same thing.
If anyone has advice on getting my MSP update installed remotely, I'd be all ears.
I think I've included all the information I have, but if something is missing, please ask questions, and I'll fill in any blanks.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
My process for this is:
Read a CSV for server name and Administrator password
Create a credential with the password
Create a new session using the machine name and credential
Create a temporary folder to hold my update MSP file
Call a PS1 file that downloads the update file to the target server
>>> Creates a new System.Net.WebClient object
>>> Uses that web client object to download from the source to the location on the target server
Call another PS1 file that applies the patch that was just downloaded –>> This is where I’m having issues.
>>> Set the variable shown above
>>> Execute the file specified in the variable
Close the session to the target server
Move to the next server in the CSV…
If I open a PS window and manually set the variable, then execute it (as shown above in the two lines of code), it works fine. If I create a PS1 file on the target server, containing the same two lines of code, then right click > ‘Run With PowerShell’ it works as expected / desired. If I remotely execute my code in PowerGUI, it returns a block of text that looks like this, then just sits there. RDP’d into the server, the installer never launches. My understanding of the “Return Value” value is that “0″ means the command was successful.
PSComputerName : xx.xx.xx.xx
RunspaceId : bf6f4a39-2338-4996-b75b-bjf5ef01ecaa
PSShowComputerName : True
__GENUS : 2
__CLASS : __PARAMETERS
__SUPERCLASS :
__DYNASTY : __PARAMETERS
__RELPATH :
__PROPERTY_COUNT : 2
__DERIVATION : {}
__SERVER :
__NAMESPACE :
__PATH :
ProcessId : 4808
ReturnValue : 0
I even added a line of code between the variable and the execution that creates a text file on the desktop, just to verify I was getting into my ‘executeFile’ file, and that text file does get created. It seems that it’s just not remotely executing my MSP.
Thank you in advance for your assistance!
Catt11.
Here's the strategy I used to embed an msp into a powershell script. It works perfectly for me.
$file = "z:\software\AcrobatUpdate.msp"
$silentArgs = "/passive"
$additionalInstallArgs = ""
Write-Debug "Running msiexec.exe /update $file $silentArgs"
$msiArgs = "/update `"$file`""
$msiArgs = "$msiArgs $silentArgs $additionalInstallArgs"
Start-Process -FilePath msiexec -ArgumentList $msiArgs -Wait
You probably don't need to use the variables if you don't want to, you could hardcode the values. I have this set up as a function to which I pass those arguments, but if this is more of a one-shot deal, it might be easier to hard-code the values.
Hope that helps!
using Start-Process for MSP package is not a good practice because some update package lockdown powershell libs and so you must use WMI call

Resources