Ant check if remote directory exists - ant

How would I check with ant if on a remote a given directory exists? Locally I can do that with the available task.

If you want to do somethong on remote computer you must have some way to connect with it. Personally I do it using ssh. With ssh you can do almost everything on a remote computer. Ant has got few tasks for ssh usage, ex <sshexec/>, <sshsesion/>. If you don't want to use ssh you need to find another way to connect with that computer but from my experience ssh is the best. Just install it on remote computer and thats it. I think that the best for you will be <sshsession/> but I haven't used it (I use only <sshexec/> because I've got problems with <sshsession/>). For example according to documentation this should work:
<sshsession host="somehost" username="dude" password="yo" localtunnels="2401:localhost:2401">
<sequential>
<available>check availability of the file</available>
</sequential>
</sshsession>

Related

Can I run a shell script on OpenWrt from a remote host using OpenWISP2?

I am working on a hardware device running OpenWrt. I was wondering if I can manage my hardware and run shell scripts etc. remotely using OpenWisp2. Is it possible? If yes, then how to do that?
Not at the moment I'm writing.
You can only send configuration files, which can include scripts that can be also added to the crontab.
Sending commands will be possible once this branch is merged: https://github.com/openwisp/openwisp-controller/pull/31

jenkins performance plugin result file from remote server

Is it possible to generate reports from remote result files?
I've tried many possibilities without any result, any help would be really appreciated :)
What I've tried
well I tried to ssh to my remote server and it didn't work, the official docs does not talk about remote results and it seems to me that the only way is to store the jmeter result file on server where jenkins is running.
i'm wondering if there is a way to do this remotely

Elevated privileges required for MsDeploy runCommand?

I'm attempting to use MsDeploy runCommand provider to uninstall and reinstall a Windows service during an automated deployment.
So far, I've been somewhat successful when following the advice in this question and this blog post.
To perform the actual install/uninstall operations, I'm calling a batch file on the remote host. The batch file works as expected when I log into the host directly and use the 'Run as Administrator' option from the shell. When simply running the batch file by double-clicking (or when running the batch file with the MsDeploy runCommand provider), the batch file doesn't have sufficient permissions to perform the install or uninstall operation. In all cases, I'm running the batch file with a user account that is a local administrator on the host.
I've confirmed that runCommand is using an administrator account through the Management Service Delegation tool, and restarted the Management Service just for the heck of it.
My questions know are:
1) How can I emulate the 'Run As Administrator' with the runCommand provider?
2) If I use a Powershell script instead of a batch file, would this still be a problem?
3) Is there something basic I'm missing here?
I would really not have to write real software to perform this action on the remote host!
Any advice would be appreciated.
Have you tried the runas MSDOS command?
runas /user:mycomputer\myusername somecommand

Setup and Use ClamAV (anti-virus) with Azure

I want to scan the files that are uploaded to my Azure blob. It looks like ClamAV (www.clamav.net) is probably the way to go. I see instructions on how to install on a Windows server, but what would my procedure be for a site hosted on Azure? I am using ASP.NET MVC.
Disclaimer: I haven't used ClamAV. Having said that...
You should be able to install it during a startup task (with elevated privileges). I looked at the ClamAV wiki, and it appears that the msi has a silent-install:
msiexec /i clamAV.msi /qr
You'll need to change that last parameter to /qn to force "no user interface."
The challenge will be scanning blobs. You'll need to copy files from their blobs to a local directory in your VM instance, and then run clamdscan on that file (basing off the wiki).
I haven't tried this, but the basic premise should hold up: Install anything requiring an MSI as a startup task (probably needs elevated mode).

Console Utility that can remote connect to other systems and issue commands

Frequenlty my work involves to VNC to a remote system and work on it. SInce i run command line apps on this remote system most of the time, i was wondering if there's an alternative software to command prompt which i could install on my local machine. Using this i should be able to create a session with the remote system and from then on all commands issued in command prompt should run in remote system.
localHost>dir --> should list the directory contents in remotehost active directory
localhost>app.exe should run app.exe in remote host and display its contents in localhost command prompt
I browsed a little and read about cmdlets in powershell. But it looks like i need to write a cmdlet for each app in the path (dir, mkdir, app.exe in the path). Correct me if am wrong. Once session is established, i simply need the commands invoked in local host to be run in the remote host and return the console output to local host. Please let me know if powershell + cmdlets are the only way
THanks
Just use PowerShell Remoting if it can be set up (requires a little preparation).
I'm not quite sure why you think of writing own cmdlets for stuff that's already there. dir is an alias to Get-ChildItem which does return the items in the current path (and—depending on options—some other stuff as well). And since PowerShell is a shell it has no problems running external programs too.
SSH is what you're looking for. Cygwin has a SSH server and client.
Unix people do this all the time with SSH. You can install the sshd server on your remote machine through Cygwin, then use PuTTY to connect to it.
As a bonus, PuTTY does not use the clunky Windows cmd.exe program; it's got a much nicer terminal of its own.
You could maybe even run PowerShell on the remote end, so you don't have to learn bash.
Depending upon on how you actuall access the machines PSExec may be an alternative that wont require you to install anything on the remote system.

Resources