X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id :references:to; q=dns; s=default; b=e4AAcTB3TARKT+JwLuhQfVNDw1pB OJTMB1S87gl0QW40yRGc6Rln3+xDCK8+LURyevJEdUJ+7JI+f1d/DapWPJldoAtV 4wwfoiMVx1idNri52T5qVKgxBQ0k5+8NFPpc1800gTPsC7dt/FORq9b++RKVu4rN uru0O9fWA07lCUw= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:content-type:mime-version:subject:from :in-reply-to:date:content-transfer-encoding:message-id :references:to; s=default; bh=5hvmj/aRKYqaMwzlwuhNmNqzzQ4=; b=MY rtTiGaR+KBlbtuaevbtqdKYuahU27UhRA9d5bb85JEeVcRC2r6+5+ORUBVrhf+Z4 uj8l9HVBpJBghYXDYRPK2n2sYctKpVV+hpvqFeKaEz/gTlyyXO83/wP3MXOuUlqK awQ+ShLFpEJX2sdc6yI/zccX/cNfoeXVbHR0nvteY= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com X-Spam-SWARE-Status: No, score=-1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,KHOP_THREADED,RCVD_IN_DNSWL_LOW,RCVD_IN_HOSTKARMA_YE,SPF_PASS autolearn=ham version=3.3.1 X-Received: by 10.180.87.33 with SMTP id u1mr11347967wiz.34.1369038729809; Mon, 20 May 2013 01:32:09 -0700 (PDT) Content-Type: text/plain; charset=iso-8859-1 Mime-Version: 1.0 (Apple Message framework v1283) Subject: Re: ps with command line arguments From: AZ 9901 In-Reply-To: <14983C5E-E9B8-49A8-B554-A9C5C026426F@gmail.com> Date: Mon, 20 May 2013 10:32:07 +0200 Message-Id: <189F0AC0-FDC2-4310-9118-A401EAED82FA@gmail.com> References: <14983C5E-E9B8-49A8-B554-A9C5C026426F AT gmail DOT com> To: cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id r4K8WPIv032363 Le 7 mai 2013 à 15:30, AZ 9901 a écrit : > Le 7 mai 2013 à 10:46, AZ 9901 a écrit : > >> Hello, >> >> I run a bash script in a multi-user environment. >> This script uses "ps -ef" in particular to list all its instances. >> >> On a common UNIX / Linux system, it gives something like this : >> bobby 20326 20318 0 10:21 ? 00:00:00 /bin/bash ./myscript.sh >> marty 20330 20342 0 10:23 ? 00:00:00 /bin/bash ./myscript.sh >> dudul 20339 20363 0 10:25 ? 00:00:00 /bin/bash ./myscript.sh >> Perfect ! >> >> With Cygwin, "ps -ef" does not give command line arguments, so the script can't list its instances. >> I was thinking about using procps or printing /proc/*/cmdline. >> However, some of the users do not have admin rights, so they are not allowed to access /proc//cmdline, /proc//stat etc... of other users... >> >> This is why "ps -ef" giving command line arguments would be really perfect ! > > I also just tested a workaround using the bash builtin command "exec". > I put the following lines at the beginning of my script : > > if [[ ! "$EXEC" ]] > then > export EXEC=1 > exec -a myscript /bin/bash "$0" "$@" > fi > > Then, on a common UNIX / Linux system, "ps -ef" gives something like this : > bobby 20326 20318 0 10:21 ? 00:00:00 myscript ./myscript.sh > marty 20330 20342 0 10:23 ? 00:00:00 myscript ./myscript.sh > dudul 20339 20363 0 10:25 ? 00:00:00 myscript ./myscript.sh > Perfect. > > But on Cygwin, it still gives this : > bobby 20326 20318 0 10:21 ? 00:00:00 /usr/bin/bash > marty 20330 20342 0 10:23 ? 00:00:00 /usr/bin/bash > dudul 20339 20363 0 10:25 ? 00:00:00 /usr/bin/bash > > I would have liked to see "myscript" instead of "/usr/bin/bash"... Hello, Do you think ps command could be corrected / improved to display "myscript" (script's name according to the example above) and/or command line arguments ? Thank you very much ! Best regards, Ben -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple