Home Ask Login Register

Developers Planet

Your answer is one click away!

Sharath Arakere February 2016

Execute a bash script in remote server through URL

I have a bash script "Hello.sh" below in my remote server "A" which is running Apache.

#! /bin/bash
echo "Hello World" > Hello.txt

I want to execute this script in remote server "A" itself by calling it's Apache URL from server "B" like below.

Please note I have made the script available through URL by keeping it in Document root of Apache.


How can this be accomplished. Thanks.


JazzCat February 2016

To be able to run shell scripts directly from the browser, you should add this rule to your .htaccess file.

Options ExecCGI AddHandler cgi-script .sh

This tells the webserver to treat .sh files as CGI scripts.

Post Status

Asked in February 2016
Viewed 3,565 times
Voted 8
Answered 1 times


Leave an answer

Quote of the day: live life