themistral Posted March 21, 2012 Share Posted March 21, 2012 Hi guys, I'm running the following code: $result = shell_exec("su user; scp /path/to/file/text.txt user@domain:/path/to/file/text.txt"); Now, the file get's transferred correctly. However, I need to put in place a check to check if the transfer was successful. $result seems to return the same whether the transfer was successful or not. I want to send an email to state whether the file transfer was successful so what do I need to do to check this? Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/259410-check-if-shell_exec-is-successful/ Share on other sites More sharing options...
trq Posted March 21, 2012 Share Posted March 21, 2012 Use exec instead and check and give it a $return_var argument. Quote Link to comment https://forums.phpfreaks.com/topic/259410-check-if-shell_exec-is-successful/#findComment-1329786 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.