Fix error handling around exec()

The way the exec() call was being handled meant the $success variable
was not being set correctly  Fixed by explicitly checking the
return code parameter of exec().  Also used the watchdog facility
to log detailed error information from exec().