#!/usr/bin/perl -w ###################################################################################### use Net::Ping; #Escape quotes and equal signs @unxerp= ("1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15"); #Quote for execution: chomp($date = qx#/bin/date #); chomp($month = qx#/bin/date +%B#); chomp($year = qx#/bin/date +%EY#); chomp($day = qx#/bin/date +%d#); chomp($hour = qx#/bin/date +%H#); chomp($min = qx#/bin/date +%M#); #chomp($webserver = qx#/sbin/hostname#); #or set whatever you like wants #$webserver = "name_of_webserver"; $webserver = "dbaweb"; $count=0; $file="/u02/app/apache2/htdocs/stats/history/$year/$month/$day/stats.$hour.$min.html"; $current_stats="stats.$hour.$min.html"; $workdir="/u02/app/apache2/htdocs/stats"; ###################################################################################### $i_am_running_file="/tmp/$0.txt"; die ("another copy of $0 is running ") if ( -e $i_am_running_file) ; system ("touch $i_am_running_file"); #mkdir first system ("mkdir -p $workdir/history/$year/$month/$day"); #open new file open (FH, ">$workdir/$current_stats") || die "cant open $current_stats:$!"; system ("ln -sf $workdir/$current_stats $workdir/stats.html"); ##################################################################################### sub printhtml { print FH "
"; print FH "\
| $line |
| $server - $line |
| $line |
"; }#end foreach cmd } print FH "
"; $i--; } chomp($date = qx#/bin/date #); print FH "$date
"; #move file in to new loc with new name system ("cp $workdir/stats.html $file") || warn "$file not copied: $!"; system ("rm $i_am_running_file");