This commit is contained in:
2024-10-14 00:08:40 +02:00
parent dbfba56f66
commit 1462d52e13
4572 changed files with 2658864 additions and 0 deletions

View File

@@ -0,0 +1,42 @@
#!/usr/bin/perl
## INSERT INTO `queue` (`id`, `port_id`, `state`) VALUES (NULL, '1', '1');
use DBI;
use strict;
# Variable für SQL Befehle
my $sql;
# DB Parameter
my ($db_user, $db_name, $db_pass, $db_host) = ('1_mfi', '1_mfi', 'K01v1kk0!', 'panel.agserver.de');
# DB connect
my $dbh = DBI->connect("DBI:mysql:database=$db_name;host=$db_host", $db_user, $db_pass) or die "Cannot connect to DB\n";
# Eintrag in Queue schreiben
#my $rows;
#for (my $i=1; $i<=9; $i++) {
# $sql = "insert into queue (port_id, state) values ($i, 1)";
# $rows = $dbh->do("$sql");
#}
#for (my $i=1; $i<=4; $i++) {
# $sql = "insert into queue (port_id, state) values ($i*2, 0)";
# $rows = $dbh->do("$sql");
#}
print "$ARGV[0]\n";
print "$ARGV[1]\n";
my $state=0;
if ($ARGV[1] eq "on") {
$state=1;
} elsif ($ARGV[1] eq "off") {
$state=0;
} else {
print "ungültiger Status\n";
exit 1;
}
$sql = "insert into queue (port_id, state, source) values ($ARGV[0], $state, 'cron')";
$dbh->do("$sql");