When with "successful" you mean it returns 0, then simply test for it:
if ! <command>; then
<ran if unsuccessful>
fi
The reason this works, is because as a standard, programs should return nonzero if something went wrong, and zero if successful.
Alternatively, you could test for the return variable $?:
<command>
if [ $? -ne 0 ]; then
<ran if unsuccessful>
fi
$? saves the return code from the last command.
Now, if is usually a shell built-in command. So, depending what shell you're using, you should check the man page of your shell for that.