We help IT Professionals succeed at work.

How to trigger Linux shell script execution from a Windows machine

1,507 Views
Last Modified: 2013-12-16
Basically there's a job to be done and each system has to do 50% of it. My Windows machine creates a file /this is done by a batch file/ and then the Linux machine is supposed to take over and finalize the job by operating on the same file. So I need to figure out a way to send a message to the Linux machine when the file in question is ready. The Linux server uses Samba to talk to the Windows machine.
Comment
Watch Question

CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT
Top Expert 2007

Commented:
Alternatively, install openssh/cygwin.
To signal Linux, you can use a number of methods.  Since you have a SMB share, you can drop a marker file in the same directory one the process is complete.  This marker file can be just a file, wtih no contents.

On the Linux system create a crontab job using the following method:

crontab -e

*/5 * * * * path_to_script/script.sh

The above line will cause the script to execute every 5 minutes.

The script could have the following to test for the existence of a file:


#!/bin/bash
 
# code to test for the marker file
if [ -f /smb_share/marker file ]; then
   cmd_to_run
   rm /smb_share/marker_file
fi

Open in new window

Author

Commented:
omarfarid:Thats exactly what Im looking for, unfortunately it doesn't seem to be working as I'm getting the following error message:
Putty error:
Unable to open connection to <whatever my command/file name was>.
 Host does not exist
In other words it thinks I'm specifying a host name rather than a command to be executed. I already have public/private key authentication setup, so it doesn't ask for a password, which is the preferred behavior.
I also tried the -m option with no success.

CERTIFIED EXPERT
Top Expert 2007
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

Commented:
That finally did the trick - I didn't have all the other tools that come with putty installed. But now I downloaded the whole package and it works like a charm. Thanks to all of you

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.