Skip to content

Instantly share code, notes, and snippets.

@schwern
Created December 11, 2012 18:39
Show Gist options
  • Save schwern/4260927 to your computer and use it in GitHub Desktop.
Save schwern/4260927 to your computer and use it in GitHub Desktop.
#!/usr/bin/env perl
use strict;
use warnings;
use Date::Manip::Date;
my($command_date_string, @command) = @ARGV;
my $command_date = Date::Manip::Date->new;
$command_date->parse($command_date_string);
my $command_time = $command_date->secs_since_1970_GMT;
my $sleep_time = $command_time - time;
if( $sleep_time >= 0 ) {
print $command_date->printf("The command will run at %C.\n");
}
else {
print "The command will run right now.\n";
}
if( !fork ) {
sleep $sleep_time if $sleep_time > 0;
exec @command;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment