Sending a Signal from windows to linux to run the script
Sending a Signal from windows to linux to run the script
Hi All,
I need desperate help to run the shell script on Linux from windows PC .
I only have script on Linux which is used to kill the process on Linux but that script needs to be run from windows.
So can some one please help me out how to start solving this issue as I have zero knowledge on this. Some how I wanted understand the whole concept from one of good explanation from anyone else.
Thanks
Gobi
I need desperate help to run the shell script on Linux from windows PC .
I only have script on Linux which is used to kill the process on Linux but that script needs to be run from windows.
So can some one please help me out how to start solving this issue as I have zero knowledge on this. Some how I wanted understand the whole concept from one of good explanation from anyone else.
Thanks
Gobi
- Nathan F
- Posts: 1764
- Joined: Wed 08 Jun 2005, 14:45
- Location: Wadsworth, OH (occasionally home)
- Contact:
Two things come to mind at present.
Install Putty on your Windows PC and use it to ssh into the Linux box. Probably easier.
The second would be to put a watch on a file using something like "inotifywait". If you access the file it sends a signal to the process watching it, which can then run some code. You could use ftp, sftp, or even samba to access the watched file.
The code for doing this with "inotifywait" is fairly simple:
Replacing <some file> and <some command> with the watched file and the command you want to run. Note that this method will keep the inotifywait program running as a background daemon until you kill it. If you only want to execute the script once, leave out the -m option.
Install Putty on your Windows PC and use it to ssh into the Linux box. Probably easier.
The second would be to put a watch on a file using something like "inotifywait". If you access the file it sends a signal to the process watching it, which can then run some code. You could use ftp, sftp, or even samba to access the watched file.
The code for doing this with "inotifywait" is fairly simple:
Code: Select all
inotifywait -m -e access <some-file> | while read EVENT
do <some command>
done
Bring on the locusts ...
Hi Nathan,
Thanks for your prompt reply. The script file in the Linux needs to be executed from windows with some conditions. But I know C but I do have zero knowledge in handling the systems. I couldn't about watchfiles which you have mentioned.
But this my plan I need to write down exe file in C on windows which should control the script on Linux .
if { send the signal to Linux to execute the script}
else
{ nothing}
but I don't know how to call the signals in C and which signal needs to be called. Also I even don't know how to interface with Linux system to send this signal to execute the script. ( all our pcs are connected via intranet)
Thanks
Gobi
Thanks for your prompt reply. The script file in the Linux needs to be executed from windows with some conditions. But I know C but I do have zero knowledge in handling the systems. I couldn't about watchfiles which you have mentioned.
But this my plan I need to write down exe file in C on windows which should control the script on Linux .
if { send the signal to Linux to execute the script}
else
{ nothing}
but I don't know how to call the signals in C and which signal needs to be called. Also I even don't know how to interface with Linux system to send this signal to execute the script. ( all our pcs are connected via intranet)
Thanks
Gobi
- Nathan F
- Posts: 1764
- Joined: Wed 08 Jun 2005, 14:45
- Location: Wadsworth, OH (occasionally home)
- Contact:
Then easy, install Putty and use ssh to log into your linux pc.
http://www.chiark.greenend.org.uk/~sgta ... on a LAN.
http://www.chiark.greenend.org.uk/~sgta ... on a LAN.
Bring on the locusts ...
Since linux and windows use different base kernels and linux uses script files while windows uses batch files, getting windows to understand and execute a linux script file would be rough.A Gobiraj wrote:Hi Nathan,
I just want to control the process on Linux from windows PC.
If one can transfer a control file/application/script to linux in such a way that th file is executed by the linux box, then you have a door.
But there is the rub.
Figuring out where to place the file with instructions to the kernel to execute said file and the file having the executable parameters set.
Lets say that one was able to place an executable into the Startup folder in linux from windows.
On a reboot of the linux system, the file would execute if its parameters had been set correctly.
If I may ask though, what is your purpose of wanting to be able to execute a file on a networked linux box using windows??
- Nathan F
- Posts: 1764
- Joined: Wed 08 Jun 2005, 14:45
- Location: Wadsworth, OH (occasionally home)
- Contact:
Don't know what happened there...
What I had type before was just reiterating that Putty is probably a good solution for what you need. It's a Windows program that includes a terminal and ssh client.
http://www.chiark.greenend.org.uk/~sgta ... nload.html
You'll need an ssh server running on the linux pc. Dropbear is a good solution if it's only going to be used over the LAN.
With that setup you can log into your Linux PC from the Windows PC and run any commands you wish.
What I had type before was just reiterating that Putty is probably a good solution for what you need. It's a Windows program that includes a terminal and ssh client.
http://www.chiark.greenend.org.uk/~sgta ... nload.html
You'll need an ssh server running on the linux pc. Dropbear is a good solution if it's only going to be used over the LAN.
With that setup you can log into your Linux PC from the Windows PC and run any commands you wish.
Bring on the locusts ...
Actually we have two system for our Simulator system.
one with Linux and other one with windows. now we have some issue on Linux part of the simulator but we need to restart the process on Linux after we have some certain number of runs on windows PC. Because windows PC is the controller so that execution should be decided by the widows PC after the certain period of times.
one with Linux and other one with windows. now we have some issue on Linux part of the simulator but we need to restart the process on Linux after we have some certain number of runs on windows PC. Because windows PC is the controller so that execution should be decided by the widows PC after the certain period of times.
But this my plan I need to write down some coding on windows which should control the script on Linux .
if { then send the signal to Linux to execute the script}
else
{ nothing}
but I don't know how to call the signals in C and which signal needs to be called. Also I even don't know how to interface with Linux system to send this signal to execute the script. ( all our pcs are connected via intranet)
if { then send the signal to Linux to execute the script}
else
{ nothing}
but I don't know how to call the signals in C and which signal needs to be called. Also I even don't know how to interface with Linux system to send this signal to execute the script. ( all our pcs are connected via intranet)
-
- Posts: 229
- Joined: Wed 25 Aug 2010, 15:38
- Location: ISM Dhanbad, Jharkhand, India
You can use TCP connections. This works whenever both computers are connected via network/internet.
On linux end you could use nc to listen at a particular port number, say 1234:
On windows computer you have to open a TCP connection to the linux computer and write the message.
nc command running in linux machine will then output the message and exit. Then your script could evaluate the message and execute commands and optionally start all over again.
On linux end you could use nc to listen at a particular port number, say 1234:
Code: Select all
nc -l -p 1234
nc command running in linux machine will then output the message and exit. Then your script could evaluate the message and execute commands and optionally start all over again.
No idea how to code scrips on Windows .
I installed http://www.cygwin.com/install.html and am running
find command when Windows search gets on my nerves or
wget -c if downloads by Firefox disrupt
from it's bash shell .
It's a learning curve, though !
I installed http://www.cygwin.com/install.html and am running
find command when Windows search gets on my nerves or
wget -c if downloads by Firefox disrupt
from it's bash shell .
It's a learning curve, though !
«Give me GUI or Death» -- I give you [[Xx]term[inal]] [[Cc]on[s][ole]] .
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P
Macpup user since 2010 on full installations.
People who want problems with Puppy boot frugal :P