PDA

Archiv verlassen und diese Seite im Standarddesign anzeigen : Prozessabfrage für Fortgeschrittene



spike
29-10-2002, 06:37
Hi Folks,

mehrere User starten ein Programm das in mehreren Versionen vorliegt. Allerdings unterscheiden sich die Programmnamen nicht, sondern nur die Pfade.

Z.B.

/opt/programm_v1/programmstart
/opt/programm_v2/programmstart

Die Quiz Frage ist wie bekomme ich raus welcher User welche Version gestartet hat, wenn die Anwender das Programm direkt, also ohne Pfad aufrufen.

In der Prozessliste ist ja max. der Aufruf ablesebar, oder habe ich da was vergessen.


System :AIX
Shell :ksh (notfalls perl)

Basti_litho
29-10-2002, 07:22
Du hast unter der PID im /proc Verzeichnis einiges an informationen unter anderem auch mit welchem aufruf bzw. Verzeichnis das Programm gestartet wurde.

Schau dich einfach mal im /proc/PID Verzeichnis um - sind wirklich ein paar nette infos zu finden.

Gruß,
Basti

spike
29-10-2002, 07:27
Danke für den Tip!
Das ist wirklich interessant, würde mir wahrscheinlich auch weiterhelfen.

Kleines Problem, unter AIX gibt es kein /proc, oder ähnliches ist ein reines Linux Ding.
Wie gesagt unter Linux ist Dein Tip top.

Grüße, Spike

fork
29-10-2002, 21:57
Benenne die Programme um(programV1.23) und setze anstatt des immer gleichen Namens ein kleines Shellscript das nur die umbenannten Programme via exec aufruft.

#!/bin/bash
exec programV1.23

Dann ps aux

> AIX ... ist ein reines Linux Ding

AIX ist UNIX, nicht Linux

anda_skoa
29-10-2002, 22:05
Original geschrieben von fork

> AIX ... ist ein reines Linux Ding

AIX ist UNIX, nicht Linux

Das hat Spike gemeint.
/proc ist ein reines Linux Ding.

Ciao,
_

fork
30-10-2002, 21:16
Das kommt davon wenn man sich statt mit deutsch mit Perl beschäftigt ;-)

spike
31-10-2002, 06:38
Hi,

nur falls jemand mal auf ein ähnliches Problem stossen sollte:

Mit dem Kommandozeilentool lsof (freeware) konnte ich mein Problem lösen (Beschreibung siehe unten).

Falls interesse besteht einfach mal bei Google nach "lsof" suchen.

Ach ja, die beschreibung ist in Englisch, solltest also diesmal keine Probleme haben fork ;-)


DESCRIPTION
Lsof revision 4.55 lists information about files opened by
processes for the following UNIX dialects:

AIX 4.1.[45], 4.2[.1], and 4.3[.123]
Apple Darwin 1.2 for Power Macintosh systems
BSDI BSD/OS 2.1, 3.[01], and 4.[01] for Intel-based systems
DEC OSF/1, Digital UNIX, Tru64 UNIX 2.0, 3.2, 4.0, and 5.[01]
FreeBSD 2.1.[67], 2.2[.x], 3.[012345], 4.[012], and 5.0 for
Intel-based systems
HP-UX 10.20, 11.00, and 11.11
Linux 2.[1234].x for Intel-based systems
NetBSD 1.[2345] for Alpha, Intel, and SPARC-based systems
NEXTSTEP 3.[13] for NEXTSTEP architectures
OpenBSD 2.[012345678] for Intel-based systems
OpenStep 4.x
SCO OpenServer Release 5.0.5 for Intel-based systems
SCO UnixWare 7.0 and 7.1.0 for Intel-based systems
Sequent PTX 2.1.9, 4.2.[13], 4.[34], 4.4[.1246], and 4.5[.1]
for Sequent systems
Solaris 2.6, 7, 8 BETA, and 8 BETA-Refresh

(See the DISTRIBUTION section of this manual page for
information on how to obtain the latest lsof revision.)

An open file may be a regular file, a directory, a block
special file, a character special file, an executing text
reference, a library, a stream or a network file (Internet
socket, NFS file or UNIX domain socket.) A specific file or
all the files in a file system may be selected by path.

Instead of a formatted display, lsof will produce output
that can be parsed by other programs. See the -F, option
description, and the OUTPUT FOR OTHER PROGRAMS section for
more information.

In addition to producing a single output list, lsof will run
in repeat mode. In repeat mode it will produce output,
delay, then repeat the output operation until stopped with
an interrupt or quit signal. See the +|-r [t] option
description for more information.