Friday, April 29, 2011

Run a Unix command remotely from Windows


After helping a customer numerous times by diagnosing a failed cron job, I was looked up how to call the job from Windows. This turned out to be interesting given it was a command which could only be run from sudo. Here are the details:

  1. First you need a program called plink which is part of the putty distribution. You can download putty from  http://the.earth.li/~sgtatham/putty/latest/x86/putty-0.60-installer.exe
  2. Create a text file with your commands somewhere on the PC. For example:
    1. /usr/bin/sudo su -
  3. Either set up your path environment variable on Windows or simply go the putty install folder (e.g C:\Program Files\Putty).
  4. plink -t zz000412@PRODDOCS-VORA -m
psexec is another command to run from windows to call a script on another windows box.

No comments: