#!/usr/bin/perl use POSIX; my $host = 'HOST'; my $user = 'USER'; my $startTime = getUnixTime(); my $timeNow = $startTime; my $duration = 0; my $auth = 0; my $tmp; # Subroutine für getUnixTime sub getUnixTime { my $sec = 40; my $min = 30; my $hour = 14; my $day = 23; my $mon = 2 - 1; my $year = 2010 - 1900; my $wday = 0; my $yday = 0; my $unixtime = mktime ($sec, $min, $hour, $day, $mon, $year, $wday, $yday); } # Subroutine für System-Call sub exec_command { system("doConnect() $cmd_login $ssh_bin $startTime $duration $auth"); } while (true) { # daemon-Schleife if ( ( ($timeNow - $startTime) % (120 + $duration) ) == 0 ) { while ( not $auth ) { # Verbindungsschleife if ( ( ($timeNow - ($startTime+$duration)) % 5 ) == 0 ) { sub doConnect { $cmd_login = "$user\@$host"; $ssh_bin = `which ssh`; chomp $ssh_bin; exec_command(); } doConnect(); # doAuth(); } $tmp = getUnixTime; $duration = $tmp - $timeNow; $timeNow = tmp; } getLogs(); disconnect(); $auth = 0; } $duration = getUnixTime() - $timeNow; $timeNow = getUnixTime(); }