[Vienna-pm] Krauses Problem mit system in Linux

Baier Oliver oliver.baier at lotterien.at
Wed May 13 00:00:17 PDT 2009


Hallo Willi,

bei mir hat dein CGI gefunkt, sobald ich dem apache ein !requiretty
im sudoers verpasst habe.

256 = shell-returnvalue x 256	=> auf der shell würdest du 1 erhalten.

Was sagt denn das apache errorlog?

lg
Oliver


> -----Ursprüngliche Nachricht-----
> Von: vienna-pm-bounces+oliver.baier=lotterien.at at pm.org 
> [mailto:vienna-pm-bounces+oliver.baier=lotterien.at at pm.org] 
> Im Auftrag von nagy
> Gesendet: Mittwoch, 13. Mai 2009 08:08
> An: vienna-pm at pm.org
> Betreff: [Vienna-pm] Krauses Problem mit system in Linux
> 
> Hallo Kollegen,
> 
> entweder bin ich etwas eingerostet in der Perl Programmierung 
> oder der Pinguin will mich nicht.
> 
>  
> 
> Folgendes kleines scriptchen will nicht funktionieren: (der 
> relevante Teil ist mit !!!!!!!!!!! gekennzeichnet)
> 
>  
> 
> Ich habe es auch ohne sudo probiert.
> 
> "exec" und  `...` macht auch nichts.
> 
>  
> 
> Der returnwert ist 256, dass will mir nichts sagen. Google 
> kann mir auch nicht helfen, aber vielleicht bin
> 
> Ich auch ein bisschen ungeschickt beim suchen.
> 
> Wahrscheinlich ist es ,nur' irgend eine abgefahreren kleine Sache.
> 
>  
> 
> Der Ausdruckt funktioniert auf der Commandline.
> 
>  
> 
> Lg
> 
> \^/ili
> 
>  
> 
> #!/usr/bin/perl -w
> 
> #
> 
> # start/stop/restart des Tomcatservers
> 
> #
> 
> #
> 
> # W. Nagy
> 
> #
> 
> #
> 
>  
> 
> use strict;
> 
> use constant VERSION=>'1.2R010';
> 
>  
> 
> use CGI;
> 
> use CGI::Carp('fatalsToBrowser');
> 
>  
> 
> my $cgi = new CGI;
> 
>  
> 
> print CGI::header();
> 
> print 
> CGI::start_html(-title=>'Tomcat::Service',-BGCOLOR=>'lightblue');
> 
>  
> 
> my $action = $cgi->param('action');
> 
>  
> 
> print("ich bin action: '${action}'");
> 
> if ($action eq 'start') {
> 
>    print "<h1>start</h1>";
> 
>    }
> 
> elsif ($action eq 'stop') {
> 
>    print "<h1>stop</h1>";
> 
> #
> 
> #   !!!!!!!!!!!!!!!!!!!!!!!!! hier ist es 
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> 
>    print system('sudo -u xxxx -p xxxxx  
> /etc/rc3.d/S86tomcat8181 stop');
> 
> # 
> !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
> !!!!!!!!!!!!!!!!!!!!!!
> 
>    }
> 
> elsif ($action eq 'restart') {
> 
>    print "<h1>restart</h1>"
> 
>    }
> 
> else {
> 
>    print "<div style=\"color:red\">Eine bislang unbekannte 
> aktion '${action}' stellt sich vor</div>";
> 
>    }
> 
> print CGI::end_html();
> 
>  
> 
>  
> 
> 


More information about the Vienna-pm mailing list