17,6 → 17,9 |
$find_key="false"; |
$listen_on_right_port="false"; |
$script="/usr/local/bin/alcasar-sms.sh"; |
$vendor=''; |
$model=''; |
$gammu_smsd_port=''; |
|
# Test if a modem is plugged on serial-usb port |
$open_port=exec("ls /dev/ttyUSB*",$openned_ports); // list of USB-Serial ports openned by a modem |
25,7 → 28,7 |
$find_key="true"; |
$vendor=exec("udevadm info -n $openned_ports[1] | grep 'MODEL=' | cut -d'=' -f2"); |
$model=exec("udevadm info -n $openned_ports[1] | grep 'MODEL_FROM_DATABASE=' | cut -d'=' -f2"); |
$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep port | cut -d ' ' -f3"); // Gammu_smsd listen port |
$gammu_smsd_port=exec("cat /etc/gammu_smsd_conf| grep '^port\s\?=' | cut -d ' ' -f3"); // Gammu_smsd listen port |
while ( list(,$row) = each($openned_ports)) |
{ |
if ( "$row" == "$gammu_smsd_port" ) // is gammu listen on an openned port ? |
39,8 → 42,7 |
{ # close gammu if it's started |
if ($gammu_pid!="") |
{ |
echo "on ferme"; |
exec("sudo $script stop"); |
exec("sudo $script --stop"); |
sleep(8); |
header('Location: autoregistration.php'); |
exit(); |