#!/usr/bin/perl # # SPDX-License-Identifier: AGPL-3.0-or-later # Copyright (c) Rainer Gümpelein, TeilRad GmbH # #sudo su www-data -c "./src/scripts/sms_message.pl shareeapp-operator locking_progress '0179xxxx372' $pos_id" # use vars qw($syshost); BEGIN { $syshost = $ARGV[0] || die 'syshost not defined'; } use lib "/var/www/copri-bike/$syshost/src"; use strict; use warnings; use POSIX; use Mod::DBtank; use Mod::SMSTransport; my $dbt = new DBtank; my $smstrans = new SMSTransport; my $todo = $ARGV[1] || die 'todo not defined'; my $phone = $ARGV[2] || die 'phone not defined'; my $pos_id = $ARGV[3] || die 'no booking id available'; my $dbh = ""; if($todo eq "locking_progress"){ sleep 45; #select booking pos if lock_state=locking still set my $booking_pos = { table => "contenttranspos", fetch => "one", c_id => "$pos_id", }; my $booking = { c_id => 0 }; $booking = $dbt->fetch_tablerecord($dbh,$booking_pos); if($booking->{int20} == 3){ $smstrans->sms_message($phone,$booking->{ct_name}); } }