Run Shell Script From Your Website

Here’s how to run a shell script from your website. You’ll need 2 files.

Here’s the contents of foo.php. Wrap your output with ‘pre’ for better formatting.

$output = shell_exec('/var/www/html/ 2>&1');
echo "$output";

Here’s the content of Output will be displayed on web page.

now="$(date +'%y%m%d')"
echo $now
aws s3 ls

Run Jekyll in Background

Jekyll is a static website generator you can use for developing simple websites. If you are running Jekyll on your desktop, you can view your static website by running a local server. If you want the leave the web server up and running in the background all the time, you can run this command instead.

# normally you run this command
jekyll serve
# running it in the background
jekyll serve > /dev/null 2>&1 &
# add incremental which builds only deltas
jekyll serve --incremental > /dev/null 2>&1 &

To kill the server, run the following.

# find jekyll server process
ps -ef | grep jekyll
# substitute pid# with process id
kill -9 pid#