wiggst3r Posted October 23, 2008 Share Posted October 23, 2008 Hi I have the following code, which I want to replace with the correct code that will run a php script if ! mount | grep -q /media/external; then echo "no backup" | mail you@home exit 1 fi All it does is checks if my external usb hdd is mounted, if not, mails me. I don't want to install any mail packages on my system. Just want to replace where the mail function is called, with a called to a php file Thanks. Quote Link to comment https://forums.phpfreaks.com/topic/129759-calling-a-php-script-in-bash/ Share on other sites More sharing options...
corbin Posted October 24, 2008 Share Posted October 24, 2008 if ! mount | grep -q /media/external; then echo "no backup" | php /some/path/to/a/php/file.php exit 1 fi Might need to put the path to php also. Quote Link to comment https://forums.phpfreaks.com/topic/129759-calling-a-php-script-in-bash/#findComment-673313 Share on other sites More sharing options...
DarkWater Posted October 24, 2008 Share Posted October 24, 2008 PHP should be in /usr/bin, so he should be fine. Quote Link to comment https://forums.phpfreaks.com/topic/129759-calling-a-php-script-in-bash/#findComment-673351 Share on other sites More sharing options...
corbin Posted October 24, 2008 Share Posted October 24, 2008 I was just trying to avoid a "It said php not found" error. Quote Link to comment https://forums.phpfreaks.com/topic/129759-calling-a-php-script-in-bash/#findComment-673468 Share on other sites More sharing options...
wiggst3r Posted October 27, 2008 Author Share Posted October 27, 2008 I used this: if ! mount | grep -q /media/disk-2; then php -f /home/test/backup/mail.php exit 1 fi Seemed to work fine I needed the php -f to call php Quote Link to comment https://forums.phpfreaks.com/topic/129759-calling-a-php-script-in-bash/#findComment-675495 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.