HTML Code to Run a Script from Remote Unix Host


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting HTML Code to Run a Script from Remote Unix Host
# 1  
Old 06-12-2012
HTML Code to Run a Script from Remote Unix Host

Hi All,

Noticed few posts around this but coudnt get exatcly what i wanted. Thanks for your help again.

I have a script running on a remote machine and i normally ssh from putty and run the script manually.

Is there anyway that i can write an HTML Code with a button so taht when I Click on a Button it will start the Script.

Can we pass arguments from HTML page? eg:- this Script has a Parameter, i would like to pass that from HTML page..

Did i ask this question in a right forum ?

Regards,
Robin
# 2  
Old 06-12-2012
First Question:
Quote:
Is there anyway that i can write an HTML Code with a button so taht when I Click on a Button it will start the Script.
There are several ways to do this, the most common is to write a CGI script that your html page will use as the "Action" of a form. You would need to read up on forms in html, and CGI.
This requires (possibly) changes to your web servers configuration file to set a "CGI" script path and the proper permissions.

Another avenue would be PHP and it's "system()" function. Again, requires adequate permissions. PHP runs the command as the user that web server is running as. That can be tricky to get right as well.

The bigger question is it the possible risk of exploit? Running a system command from a web page is usually ill advised. You are opening the door to all kinds of unexpected behavior, not the least of which is being hacked.


Second Question:
Quote:
Can we pass arguments from HTML page? eg:- this Script has a Parameter, i would like to pass that from HTML page..
Certainly, html forms can use the "GET" or "POST" method to pass parameters. Usually a text box, or check boxes, or even a drop down can be used to select the parameters you want in the form. Then when you click your submit button, these values are sent to the "action" script/page for procession using the "GET" or "POST" method.


I would start by reading up on html forms, once you can get the form to submit to another page and you can print the correct strings on the resulting page... then start looking into php or cgi.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Run awk command on remote host

I have below command to check for error logs from last 24 hours from the file : /var/log/messages/ The command is working fine on the local host. sudo awk -F - -vDT="$(date --date="24 hours ago" "+%b %_d %H:%M:%S")" ' DT < $1' /var/log/messages | egrep -i "error|fail" I want to run the... (8 Replies)
Discussion started by: rahul2662
8 Replies

2. Shell Programming and Scripting

Last part of script to remote host not working...

Hi, I got most of the script working, last part which does the ssh to remote and execute the command not working. for SSH in ${HostList}; do echo ${SSH} echo "" SSH2SEND=ssh user@${SSH} curl -v $URL echo $SSH2SEND done error message I am getting ... (5 Replies)
Discussion started by: samnyc
5 Replies

3. Shell Programming and Scripting

Check/get the exit status of a remote command executed on remote host through script

Geeks, Could you please help me out in my script and identify the missing piece. I need to check/get the exit status of a remote command executed on remote host through script and send out an email when process/processes is/are not running on any/all server(s). Here's the complete... (5 Replies)
Discussion started by: lovesaikrishna
5 Replies

4. Shell Programming and Scripting

Run script on remote host

Hi friends, I have two servers. Server A and B. I want to run one script on server A by logging in to server B. Can anyone provide me code for this.? I tried it by using following ssh username@serverA ./script Then it prompt me the password. I give correct password of the server A. but it... (7 Replies)
Discussion started by: Nakul_sh
7 Replies

5. Shell Programming and Scripting

Pause processes in remote host and resume execution in another remote host

Hi, Given addresses of 2 remote machines, using a shell script is it possible to get the state of running processes in "src" stop all the processes in "src" exit out of "src" ssh into "dest" resume the state of executing processes captured in step 1 in "dest" Assumption: "src" is... (3 Replies)
Discussion started by: Saeya Darsan
3 Replies

6. Shell Programming and Scripting

How to run a shell script on a remote host using ftp

Hi, is there a way I can run a shell script through ftp on a remote host? The remote host doesn't have ssh running so I can't use ssh. (7 Replies)
Discussion started by: mrskittles99
7 Replies

7. Shell Programming and Scripting

Plz help me using expect script for remote host

I am newbie in Unix and Expect script, so please help me :( I'm using expect script for remote another host: #!/usr/bin/expect -f set timeout 10 spawn ssh -l root 10.120.18.4 expect "password:" send "password\r" expect "@" interact And now how can i use expect script for access mysql... (2 Replies)
Discussion started by: wormym
2 Replies

8. UNIX for Dummies Questions & Answers

Run a script on remote host

Hi, I wish to run a script located on a remote host machineB from machineA. I am using ssh and running the below on machineA. However, the ssh does not seem to work and freezes at ssh -l wlsadmin machineB -v Sun_SSH_1.1.2, SSH protocols 1.5/2.0, OpenSSL 0x0090704f debug1: Reading... (9 Replies)
Discussion started by: shifahim
9 Replies

9. Shell Programming and Scripting

Run a shell script from one host which connext to remote host and run the commands

I want to write a script which would run from one host say A and connect to other remote host B and then run rest of commands in that host. I tried connecting from A host to B with SSH but after connecting to host B it just getting me inside Host B command prompt. Rest of the script is not running... (6 Replies)
Discussion started by: SN2009
6 Replies

10. Shell Programming and Scripting

How can my unix shell script automatically connect to remote host?

How can my unix shell script automatically connect to remote host? Assume that there is a remote host called "rhost". When I connect to that host i give the command "telnet rhost". It then asks me for my id and password. Once i give it connects there. I want to automate these steps. I want... (8 Replies)
Discussion started by: digdarshan
8 Replies
Login or Register to Ask a Question