[MKDoc-commit] [1.8] create newsletter cronjobs

bruno at mkdoc.demon.co.uk bruno at mkdoc.demon.co.uk
Thu Dec 2 13:48:02 GMT 2004


Log Message:
-----------
[1.8] create newsletter cronjobs

Modified Files:
--------------
    mkd/tools:
        install-details-gt.pl

-------------- next part --------------
Index: install-details-gt.pl
===================================================================
RCS file: /var/spool/cvs/mkd/tools/install-details-gt.pl,v
retrieving revision 1.37
retrieving revision 1.38
diff -Ltools/install-details-gt.pl -Ltools/install-details-gt.pl -u -r1.37 -r1.38
--- tools/install-details-gt.pl
+++ tools/install-details-gt.pl
@@ -63,6 +63,7 @@
 # create the new domain using the current system user
 my $domain_name = $1 if $MKDoc::Site::Config::CONFIG->{site_dir} =~ m{/?([^/]+)/?$};
 my $domain = create_domain ($user);
+enable_newsletter ($user);
 enable_mail ($domain, $domain_name);
 set_options ($domain);
 
@@ -499,6 +500,24 @@
     return $domain;
 }
 
+sub enable_newsletter
+{
+    my $user_name = shift;
+
+    print "Creating Newsletter cronjobs\n";
+    my $domain_name;
+    $domain_name = $1 if $MKDoc::Site::Config::CONFIG->{site_dir} =~ m{/?([^/]+)/?$};
+    $domain_name or die "could not get site name";
+    my $site_dir = $MKDoc::Site::Config::CONFIG->{site_dir};
+
+    require GPanel::Crontab;
+    my $c = GPanel::Crontab->new(user => $user_name);
+    my $rand_60 = int (rand (60));
+    $c->add_raw->value("$rand_60 8 * * *   source $site_dir/mksetenv.sh && 020..newsletter.pl day");
+    $c->add_raw->value("$rand_60 8 * * mon source $site_dir/mksetenv.sh && 020..newsletter.pl week");
+    $c->add_raw->value("$rand_60 8 1 * *   source $site_dir/mksetenv.sh && 020..newsletter.pl month");
+    $c->write;
+}
 
 sub enable_mail
 {


More information about the MKDoc-commit mailing list