Linux – way to make output from bash script visible in browser

bashlinuxPHP

I have made a script for svn update for programmers. The script works fine from bash. Programmers want to execute it from browser (via theirs administrator site).

Script is very simple (its only example not exacly the same)


#!/bin/bash
echo "Start update..."

cd /dir/with/site

/usr/bin/svn update
echo "Update ended."

 

In browser bash script is starting via php file something like:


echo system('/updatesvnscript.sh');

After executing it in bash I can see all output from echos and svn aplication, script is working good in bash.

Starting script in browser via php gives me output only from echos, like Start update... Update ended., but no output from svn. Problem is that the script also doesn't update my site when I make update via browser, so I need to find where is the problem.

So I want to see output from svn in browser to see if something with svn via browser isnt working.

Bash script has proper rights to execute it via browser, and has a proper right to modify (update) file in site directory.

Best Answer

Switch to the user id under which your web server/php runs as, then manually run,

cd /dir/with/site
/usr/bin/svn update

and see what you get.

Or, change

/usr/bin/svn update

to

/usr/bin/svn update 2>&1

which will redirect error messages to stdout, which should then show up in your web page to help with diagnosis.