Now i run the clink program in cron deamon with the help of a perl program.
For this i first learn how to put the enteries in the cron
deamon.For this i follow the following steps
type at command prompt
$ crontab -e
it will show you the cron file for you .now to run the program by cron
deamon i type as
# m h dom mon
dow command
45 23 *
* *
~ap_tayal/clin/clink.1.0/test.pl
m
= Minute
h
= Hour
dom =
Day of month
mon =
Month
dow =
DayOfWeek
command= ThingToDo
now it run my program every day ,every month ,every day of week at 23:45
.
where "~ap_tayal/clin/clink.1.0/test.pl"
that is location of my program.please note that it will not look your .bashrc
so you have to give the proper location of program.
Following is my program which give me the graph of the output.
#!/usr/bin/perl
open("f",">>/home/ap_tayal/clin/clink.1.0/finalresult");
open("f2","/home/ap_tayal/clin/clink.1.0/count");
$date=`/bin/date`;
@a=`clink -q2 www.iisc.ernet.in`;
#######
Running the clink program ###########
foreach(@a)
{
if(~ /bw= (.*s)$/g)
{
$bw=$1;@bw=split(/,/,$bw);shift(@bw);$r=shift(@bw);
######### Excessing the bandwidth
from output ############
}
}
while(<f2>)
{
$no=$_;
}
close(f2);
$no++;
select(f);
$|=1;
print $r," ",$no," #",$date;
############## Putting the values into
the file ######################
open("f2",">/home/ap_tayal/clin/clink.1.0/count");
select(f2);
$|=1;print $no;
close(f);
close(f2);
here note that i give the full path of my files which i want to be open
by the perl program.In this program i simply call the clink program putting
its output in to an array taking the value of bandwidth.Now putting this
value in to the file and in last of the program i run the command which
will use to plot the gnu plot of the bandwidth.
so if i run the command just
$ gnuplot plot
it will give me the final plot. Where plot is my files name in which
i have write some commands so that each time you have no need to write
the whole command.
One graph i have plotted it's as :
In this graph i m not been able to put the exact dates at which i have
taken this values. But i have these dates in a file which i
m showing below as
As you see program is running every hour at :45:00 time . These values i have taken about one month before.5.704 1 #Thu Nov 8 17:45:00 IST 2001 5.533 2 #Thu Nov 8 18:45:00 IST 2001
5.618 3 #Thu Nov 8 19:45:00 IST 2001 6.272 4 #Thu Nov 8 20:45:00 IST 2001
6.716 5 #Thu Nov 8 21:45:01 IST 2001 6.128 6 #Thu Nov 8 22:45:00 IST 2001
6.674 7 #Thu Nov 8 23:45:00 IST 2001 6.470 8 #Fri Nov 9 00:45:00 IST 2001
5.838 9 #Fri Nov 9 01:45:00 IST 2001 6.038 10 #Fri Nov 9 02:45:00 IST 2001
6.661 11 #Fri Nov 9 03:45:00 IST 2001 5.596 12 #Fri Nov 9 04:45:00 IST 2001
6.468 13 #Fri Nov 9 05:45:00 IST 2001 6.504 14 #Fri Nov 9 06:45:00 IST 2001
6.841 15 #Fri Nov 9 07:45:00 IST 2001 5.738 16 #Fri Nov 9 08:45:00 IST 2001
6.088 17 #Fri Nov 9 09:45:00 IST 2001 6.105 18 #Fri Nov 9 10:45:00 IST 2001
7.134 19 #Fri Nov 9 11:45:00 IST 2001 6.455 20 #Fri Nov 9 12:45:00 IST 2001
5.821 21 #Fri Nov 9 13:45:00 IST 2001 5.644 22 #Fri Nov 9 14:45:00 IST 2001
6.836 23 #Fri Nov 9 15:45:00 IST 2001 5.980 24 #Fri Nov 9 16:45:00 IST 2001
6.217 25 #Fri Nov 9 17:45:00 IST 2001 5.392 26 #Fri Nov 9 18:45:00 IST 2001
6.339 27 #Fri Nov 9 19:45:00 IST 2001 5.727 28 #Fri Nov 9 20:45:00 IST 2001
5.936 29 #Fri Nov 9 21:45:00 IST 2001 6.404 30 #Fri Nov 9 22:45:00 IST 2001
5.934 31 #Fri Nov 9 23:45:00 IST 2001 5.876 32 #Sat Nov 10 00:45:00 IST 2001
5.827 33 #Sat Nov 10 01:45:00 IST 2001 6.445 34 #Sat Nov 10 02:45:00 IST 2001
6.282 35 #Sat Nov 10 03:45:00 IST 2001 6.033 36 #Sat Nov 10 04:45:01 IST 2001
5.321 37 #Sat Nov 10 05:45:00 IST 2001 5.278 38 #Sat Nov 10 06:45:00 IST 2001
5.986 39 #Sat Nov 10 07:45:00 IST 2001 7.185 40 #Sat Nov 10 08:45:00 IST 2001
0.174 41 #Sat Nov 10 09:45:00 IST 2001 0.193 45 #Sat Nov 10 13:45:00 IST 2001
0.069 46 #Sat Nov 10 14:45:00 IST 2001 0.926 47 #Sat Nov 10 16:45:00 IST 2001
0.379 48 #Sat Nov 10 17:45:00 IST 2001 0.379 49 #Sat Nov 10 18:45:00 IST 2001
0.046 51 #Sat Nov 10 20:45:00 IST 2001 0.088 52 #Sat Nov 10 21:45:00 IST 2001
0.069 58 #Sun Nov 11 03:45:00 IST 2001 0.981 59 #Sun Nov 11 04:45:00 IST 2001
0.232 64 #Sun Nov 11 09:45:00 IST 2001 7.558 65 #Sun Nov 11 10:45:00 IST 2001
0.280 69 #Sun Nov 11 14:45:00 IST 2001 0.084 70 #Sun Nov 11 15:45:00 IST 2001
0.069 72 #Sun Nov 11 17:45:00 IST 2001 0.113 73 #Sun Nov 11 18:45:00 IST 2001