4

I have an application which has components on Windows and Unix. I need to run overnight jobs which initiate tasks/jobs on both environment.

These need to be sequenced so I cannot simple use Cron / Task Scheduler.

For each job, there will be a controlling script either on Windows or Unix, but this script will need to initiate jobs on the other environment and detect when they are complete and a success/failure code.

In the past I have achieved this using 'flag files' on a samba share. This worked but required 'polling' behaviour on the receiving end which I do not consider optimal.

I would prefer not to have to embed user credentials in script if possible.

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
andyb
  • 161
  • 6
  • 1
    You might need to look at a cross platform job scheduler depending on the size of the environment. There are Enterprise level apps (eg. Control-M etc) that can do this sort of thing (Job completed on one platform then results in job on other platform executing. Otherwise your flag file option would be one way or if you had your app (or a component) exchange messages on job status and completion. As an example creating a simple Java server on one or both ends and have that trigger the jobs at each end when client sends message that it's part is done. – Enigman Aug 21 '14 at 01:07
  • 1
    Good case for Powershell SSH module maybe? http://gallery.technet.microsoft.com/scriptcenter/SSH-PowerShell-Module-17616e1a?utm_content=buffer18183&utm_medium=social&utm_source=twitter.com&utm_campaign=buffer – Ryan Ries Aug 21 '14 at 02:03
  • Thanks @Enigman. I agree that a dedicated scheduler would be perfect for this excercise, but I doubt if the scale warrants the expense. The Java server sounds interesting but I was hoping not to have to re-invent any wheels. I believe it's possible to script PuTTy for Win->Unix, but I cannot find any alternative for the reverse direction. – andyb Aug 21 '14 at 02:06

2 Answers2

1

If you can get away with using SSH I would suggest on installing FreeSSHD on the Windows machine and executing the processes in that manner. FreeSSHD does not replicate the BASH shell but it will give you a windows shell.

monksy
  • 357
  • 1
  • 3
  • 14
  • Thanks @monksy. Is that scriptable such that, for example, a Unix cron job could use SSH to start a Windows process? – andyb Aug 25 '14 at 20:46
  • All SSH does is that it brings up a shell for you. In this case it's a Windows shell. So you can send in all the commands via STDIN that you want. – monksy Aug 25 '14 at 22:18
0

In the end, I ran the controlling process in Windows and used PLINK to execute commands in Unix. Using PLINK I was able to capture console output and exit codes generated by the Unix process and process them in Windows.

I set up public key based, 'password-less' authentication. Guidance on setting this up is in the PLINK documentation.

andyb
  • 161
  • 6