Take a look at the exec() function. You can pass in a return_var which will hold the exit code from the shell script.
$out = array();
$status = -1;
exec( '/path/to/sync.sh', $out, $status );
if ( $status != 0 ) {
// shell script indicated an error return
}
One thing to watch out for is that the script will run with the web server's permissions, not your own as a user.
Also, be sure to heed the doc's security-related warning:
When allowing user-supplied data to be passed to this function, use
escapeshellarg() or escapeshellcmd() to ensure that users cannot trick
the system into executing arbitrary commands.