#!/usr/bin/perl -w

use strict;

exit unless (-e "/var/qmail/control/servercert.pem");

my @crontab = `crontab -l`;

my $min1  = int rand 59;
my $h1    = int rand 7;

my $min2  = int rand 59;
my $h2    = int rand 7;

push @crontab, "$min1    $h1   * * * nice -n 19 /var/qmail/bin/update_tmprsadh 1>/dev/null 2>&1\n";
push @crontab, "$min2    $h2   * * * nice -n 19 /opt/pdadmin/bin/ci_dhe_params.sh 1>/dev/null 2>&1\n";

my $x = "$$.@{[rand 66666]}";
open TMP, ">/tmp/crontab.$x";
print TMP @crontab;
close TMP;
system "crontab /tmp/crontab.$x";
unlink "/tmp/crontab.$x";
