I have a bash script that mounts a usb drive, reads a text file on the usb drive, and echos that file to the php program that called it. The mount and unmount does not work.
If I mount the usb from command line the php works. Evidence points to the umount and mount not working. Any feedback would be appreciated.
Bash Script: DisplayTextFile.sh
#! /bin/bash
umount /dev/sdc1
mount -t vfat /dev/sdc1 /media/usbdisc -o uid=1000,gid=1000,utf8,dmask=000,fmask=000
$filetoecho=$(</media/usbdisc/textfile.txt)
echo "File Content: $filetoecho"
umount /dev/sdc1
exit $?
PHP that Calls Bash Script:
ob_start();
$command="/bin/bash /path/DisplayTextFile.sh"
passthru($command, &$result);
$filetoecho=ob_get_contents();
ob_end_clean();
/bin/mountand/bin/umount? - arco444/bin/bashor/bin/shto the user executing thephpscript in your sudoers file. - Alex