From 1a05343d41fb6d7fb4c3f6a1b2cdc9522bb035ce Mon Sep 17 00:00:00 2001 From: Sebastian Schmelzer Date: Tue, 11 Aug 2009 12:06:52 +0000 Subject: distroutils update git-svn-id: http://svn.openslx.org/svn/openslx/openslx/trunk@3069 95ad53e4-c205-0410-b2fa-d234c58c8868 --- lib/OpenSLX/DistroUtils/Ubuntu.pm | 77 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) (limited to 'lib/OpenSLX/DistroUtils/Ubuntu.pm') diff --git a/lib/OpenSLX/DistroUtils/Ubuntu.pm b/lib/OpenSLX/DistroUtils/Ubuntu.pm index b2526828..915c19c6 100644 --- a/lib/OpenSLX/DistroUtils/Ubuntu.pm +++ b/lib/OpenSLX/DistroUtils/Ubuntu.pm @@ -84,9 +84,86 @@ sub _renderHighlevelConfig { $shortname ) ); + + $tpl = "log_daemon_msg \"Restarting %s\" \"%s\"\n"; + $tpl .= "\$0 stop\n"; + $tpl .= "case \"\$?\" in\n"; + $tpl .= " 0|1)\n"; + $tpl .= " \$0 start\n"; + $tpl .= " case \"\$?\" in\n"; + $tpl .= " 0) log_end_msg 0 ;;\n"; + $tpl .= " 1) log_end_msg 1 ;; # Old process is still running\n"; + $tpl .= " *) log_end_msg 1 ;; # Failed to start\n"; + $tpl .= " esac\n"; + $tpl .= " ;;\n"; + $tpl .= " *)\n"; + $tpl .= " # Failed to stop\n"; + $tpl .= " log_end_msg 1\n"; + $tpl .= " ;;\n"; + $tpl .= "esac\n"; + $tpl .= ";;\n"; + $initFile->addToCase('restart', + sprintf( + $tpl, + $shortname + ) + ); + + $tpl = "start-stop-daemon --stop --signal 1 --quiet "; + $tpl .= "--pidfile /var/run/%s.pid --name \$s\n"; + $tpl .= "return 0\n"; + $initFile->addToCase('reload', + sprintf( + $tpl, + $shortname, + $element->{binary} + ) + ); + + $tpl = "status_of_proc -p /var/run/%s.pid %s_BIN %s && exit 0 || exit \$?"; + $initFile->addToCase('status', + sprintf( + $tpl, + $element->{shortname}, + $element->{binary}, + $element->{shortname} + ) + ); + + + } + case 'function' { + my $tpl; + $tpl = "%s () { \n"; + $tpl .= "%s"; + $tpl .= "\n}\n"; + $initFile->addToBlock('functions', + sprintf( + $tpl, + $element->{name}, + $element->{script} + ) + ); + + } + case 'functionCall' { + my $tpl; + $tpl = "%s %s\n"; + #$tpl .= "%s\n "; + $initFile->addToCase($element->{block}, + sprintf( + $tpl, + $element->{function}, + $element->{parameters}, + "" + ), + $element->{priority} + ); + } + } } -- cgit v1.2.3-55-g7522