Running a bash script from an HTML link or button

bashhtml

I have a webserver that's hosting lots of images. I want the client to be able to press a button or a link, which will run a bash script, which will create a video based on all these pictures. The script I'm trying to run is this:

#!/bin/bash
# cd to the directory
cd /var/www/gallery

# use ffmpeg to make video
ffmpeg -pattern_type glob -i 'img-*jpg' -r 1 video.mp4

# Take the first file in the directory and name it video.mp4.jpg (for thumbnail)
cp `ls | sort -n | head -1` video.mp4.jpg

The script is located on the server. So when the client clicks the link or button, the script will run, and the video is created. I've tried both solutions listed here but I can't seem to get it to work. I have php installed on my server.

Best Answer

You can do serverside scripting in bash without problem.

Here a short tutorial how to do it: http://www.yolinux.com/TUTORIALS/BashShellCgi.html

Related Question