Mailing List Archive

Support open source code!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: tlug: Start and stop Apache on TL2.0



> Where is http.pid on TL2.0J and how to stop and start again Apache? 
> Please let me know.

You don't need any. Look up how httpd is called up using ps ax.
Then do a killall -15 <the_stuff_you_got_from_ps_ax>.

In the following I list a few perl scrips I made to facilitate
these things

================================listpid*=====================
#!/usr/bin/perl
@example.com=@example.com;
if ($parameter[0] eq "") {
        die "Usage: listpid <processname>\n";
}
@example.com = s ax;
$schalter = "1";
foreach $zeile (@example.com) {
        @example.com = split(/ +/,$zeile);
        chomp (@example.com);
        if ($satz[5] =~ /$parameter[0]/) {
                print $satz[1]."   ".$satz[5]."\n";
                $schalter = "2"
        }
}
if ($schalter == "1") {
        print  "No such process\n";
}

=============================killname*=======================
#!/usr/bin/perl
@example.com=@example.com;
if ( !($parameter[0] =~ /-/) || ($parameter[1] eq "")) {
        die "Usage: killname <signal> <processname>\n";
}
@example.com = s ax;
$schalter = "1";
foreach $zeile (@example.com) {
        @example.com = split(/ +/,$zeile);
        chomp (@example.com);
        if ($satz[5] =~ /$parameter[1]/) {
                print $satz[1]."   ".$satz[5]."\n";
                $zack = ill $parameter[0] $satz[1];
                $schalter = "2"
        }
}
if ($schalter == "1") {
        print  "No such process\n";
}
==========================relaunch*==========================
#!/usr/bin/perl
@example.com=@example.com;
if ( !($parameter[0] =~ /-/) || ($parameter[1] eq "")) {
        die "Usage: relaunch <signal> <processname>\n";
}
@example.com = s ax;
$schalter = "1";
foreach $zeile (@example.com) {
        @example.com = split(/ +/,$zeile);
        chomp (@example.com);
        if ($satz[5] =~ /$parameter[1]/) {
                print $satz[1]."   ".$satz[5]."\n";
                $zack = ill $parameter[0] $satz[1];
                $zack = $satz[5];
                $schalter = "2"
        }
}
if ($schalter == "1") {
        $zack = $parameter[1];
        print $zack;
}
=============================================================

All the above operate on the pattern provided in the command
line. If this pattern is found in ps' COMMAND field, they
operate on that. So be careful ! If you just pass one character
all processes where this character is found are affected - with
very undesirable consequences !

listpid lists the pids of the processes with the pattern you
passed on the command line, killname sends a kill to all these
processes ( you specify the signal on the command line ) and
relaunch kills the process and restarts it. Relaunch has a
bug: if ti can't find a process running before and the pattern
given is not the full name of a command it starts nothing.

So a killname -15 httpd should solve your problem......

Copy these scripts int /usr/bin or so and make them executable
( chmod 700 and chown root.root is good ).

The names in the scripts are in German. This is not because I
dislike English but because all the reserved words are in
English and I always forget them. Using another language avoids
that kind of trouble ( some friends of mine in Slovenia do it in
Slovenian exactly for the same reason.... ).

Hope that helps. The scripts are under GNU/GPL 2.0 or higher as
usual. So if you want to improve them, do so to your hear's
content.

                              Karl-Max Wagner
                              karlmax@example.com
--------------------------------------------------------------
Next Nomikai: 18 September, 19:30 Tengu TokyoEkiMae 03-3275-3691
Next Meeting: 10 October, Tokyo Station Yaesu central gate 12:30
--------------------------------------------------------------
Sponsor: PHT, makers of TurboLinux http://www.pht.co.jp


Home | Main Index | Thread Index

Home Page Mailing List Linux and Japan TLUG Members Links