Prestart and Poststop-Hooks added
authorurs <urs@nerd2nerd.org>
Tue, 12 Jun 2007 19:40:19 +0000 (19:40 +0000)
committerurs <urs@nerd2nerd.org>
Tue, 12 Jun 2007 19:40:19 +0000 (19:40 +0000)
create-sysvinit-file.pl
examples/cron.metainit

index 8b851f0..e9e3839 100644 (file)
@@ -23,7 +23,7 @@ EOF
 print "# Riequired-Start:   " . join(" ",@{$initparams{"Required-Start"}}) . "\n";
 print "# Required-Stop:     " . join(" ",@{$initparams{"Required-Stop"}}) . "\n";
 print "# Description:       ";
-print join("\n#                    ",split("\n",$initparams{"Description"}));
+print join("\n#                    ",split("\n",$initparams{"Description"})). "\n";
 print "\n";
 
 print << "EOF"
@@ -66,6 +66,15 @@ print << 'EOF'
 #
 do_start()
 {
+EOF
+;
+
+if($initparams{"Prestart-Hook"}) {
+    print "\t" . join("\n\t",split("\n",$initparams{"Prestart-Hook"}));
+    print "\n";
+}
+
+print << 'EOF'
        # Return
        #   0 if daemon has been started
        #   1 if daemon was already running
@@ -103,6 +112,15 @@ do_stop()
        [ "$?" = 2 ] && return 2
        # Many daemons don't delete their pidfiles when they exit.
        rm -f $PIDFILE
+EOF
+;
+
+if($initparams{"Poststop-Hook"}) {
+    print "\t" . join("\n\t",split("\n",$initparams{"Poststop-Hook"}));
+    print "\n";
+}
+
+print << 'EOF';
        return "$RETVAL"
 }
 
index 9541f4a..cb88736 100644 (file)
@@ -7,4 +7,7 @@ Description: cron is a standard UNIX program that runs user-specified
 Exec: /usr/sbin/cron -f
 Required-Start: $syslog $time
 Required-Stop: $syslog $time
-
+Prestart-Hook: echo "This is the Prestart-Hook";
+ echo "It outputs two lines.";
+Poststop-Hook: echo "This is the Poststop-Hook";
+ echo "All it does, is print this.";