Re: Get instance names from PIDS?
Posted in 2011
You can deduce the server number from the shared memory key number - for
example, using a script like this:
#!/bin/perl -w
#
# @(#)$Id: shmkeynum.pl,v 1.1 2008/07/03 00:18:57 jleffler Exp $
#
# Convert IDS shared memory key to Informix server number
# 0x52754803 ==> Server 31
# 0x52754802 ==> Server 31
# 0x52754801 ==> Server 31
# 0x52674805 ==> Server 17
# 0x52674804 ==> Server 17
# 0x52674803 ==> Server 17
sub implausible
{
my($hex) = @_;
return 1 if (($hex & 0xFF00) != 0x4800);
return 1 if (($hex & 0xFF000000) != 0x52000000 &&
($hex & 0xFF000000) != 0x53000000);
return 0;
}
foreach my $arg (@ARGV)
{
my ($hex) = hex($arg);
my ($num) = (($hex & 0x01FF0000) >> 16) - 0x56;
if (implausible($hex) || ($num < 0 || $num > 255))
{
printf "Invalid $arg\\n";
}
else
{
printf "%3d $arg\\n", $num;
}
}
Example use:
$ shmkeynum 52674805 52564800 53554800
17 52674805
0 52564800255 53554800
$
On Fri, Apr 22, 2011 at 06:21, Fernando Nunes <domusonline@gmail.com> wrote:
> I usually have a config file with all the instances and a function to get
> all the environments.
> So if I had to do that I would go through the list, set every environment,
> check if it was up and stop it.
>
> This is useful for a lot of other situations, so I usually wouldn't bother
> in trying tricks that only solve one issue.
> Regards.
>
>
> On Thu, Apr 21, 2011 at 2:11 PM, Malc <malcrp@googlemail.com> wrote:
>
>> Here's one for you:
>> HP-UX 11i, IDS9.5
>> Imagine I'm trying to find out which instances are up and running in
>> an automated shutdown script,and I have no prior knowledge of the
>> setup. Although I know where the onconfig files are, I don't know
>> which ones have been started up.
>>
>> I can see there are some instances running using ps -fu informix; I
>> can then find the informix main cpuvp PIDs from ps -ef and looking for
>> the ones with PPID=1; there could be one or several.
>>
>> How can I find the instance names that are running (from that PID
>> info?) so that I can automatically set INFORMIXSERVER to that value
>> and run onmode -yuck?
>>
>> I've looked in /INFORMIXTMP, and all there is in there is several
>> "VP.<instancename>soc.<number>.s" files, some relating to running
>> instances and some not, and they're length 0 anyway.
>> I've looked in ${INFORMIXDIR}/etc/ and the .conf.<instancename>
>> and .infos.<instancename> files don't hold any PID info either.
>>
>> I could look in the message logs and see which instances don't have
>> "Informix Dynamic Server Stopped" at the end, but that's similarly not
>> reliable.
>>
>> ipcs isn't useful either.
>>
>> Any clues?
>> _______________________________________________
>> Informix-list mailing list
>> Informix-list@iiug.org
>> http://www.iiug.org/mailman/listinfo/informix-list
>>
>
>
>
> --
> Fernando Nunes
> Portugal
>
> http://informix-technology.blogspot.com
> My email works... but I don't check it frequently...
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>
>
--
Jonathan Leffler <jonathan.leffler@gmail.com> #include <disclaimer.h>
Guardian of DBD::Informix - v2008.0513 - http://dbi.perl.org
"Blessed are we who can laugh at ourselves, for we shall never cease to be
amused."