init III
This commit is contained in:
40
Perl control mFi/write_queue.pl
Normal file
40
Perl control mFi/write_queue.pl
Normal file
@@ -0,0 +1,40 @@
|
||||
#!/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");
|
||||
#}
|
||||
|
||||
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, forced) values ($ARGV[0], $state, 'cron', $ARGV[2])";
|
||||
$dbh->do("$sql");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user