You could capture the output of the "date" command in Linux. I wrote this small example in Perl but you can follow the logic.
- Code: Select all
#!/usr/bin/perl -w
use strict;
my $date = `date`;
my $bday = "Jan 15 22:30:00";
my @array = split(/ /, $date);
my $string = $array[1]." ".$array[2]." ".$array[3];
if ($string eq $bday) {
print "It is your birthday!\n";
}else{
print "Not yet!\n";
}
You just need to make sure you keep the format of $bday the same as this is a portion of the same format that the "date" command in Linux will return. As far as the reporting how long left until your birthday I am sure you can handle the math functions. The thing about getting your results down to the second is that you would have to run the script every second to be accurate which would chew up quiet a bit of system resources.