Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

Your good nature will bring unbounded happiness.


computers / comp.sys.mac.system / Re: script under launchd

SubjectAuthor
* script under launchdDr Eberhard Lisse
`* Re: script under launchdLewis
 `* Re: script under launchdDr Eberhard Lisse
  `* Re: script under launchdLewis
   `- Re: script under launchdDr Eberhard Lisse

1
script under launchd

<j6f4rcFu3g7U2@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=13700&group=comp.sys.mac.system#13700

  copy link   Newsgroups: comp.sys.mac.system
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nos...@lisse.NA (Dr Eberhard Lisse)
Newsgroups: comp.sys.mac.system
Subject: script under launchd
Date: Tue, 8 Feb 2022 14:09:15 +0200
Lines: 7
Message-ID: <j6f4rcFu3g7U2@mid.individual.net>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net sT+k3LClT8t4PyEauwv5jQVTY98gkR5Tc51OZQ3zi+h9/5Tyzg
Cancel-Lock: sha1:uyRVZpeOUJHAyCNNAIUXrV5l6L8=
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.2)
Gecko/20060308 Thunderbird/1.5.0.2 Mnenhy/0.7.4.0
Content-Language: en-US
 by: Dr Eberhard Lisse - Tue, 8 Feb 2022 12:09 UTC

Hi,

how can a (bash) script find out whether it runs under launchd?

el
--
To email me replace 'nospam' with 'el'

Re: script under launchd

<slrnt05cf0.2lht.g.kreme@m1mini.local>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=13703&group=comp.sys.mac.system#13703

  copy link   Newsgroups: comp.sys.mac.system
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!kreme.dont-email.me!.POSTED!not-for-mail
From: g.kr...@kreme.dont-email.me (Lewis)
Newsgroups: comp.sys.mac.system
Subject: Re: script under launchd
Date: Tue, 8 Feb 2022 18:09:37 -0000 (UTC)
Organization: Miskatonic U
Lines: 20
Message-ID: <slrnt05cf0.2lht.g.kreme@m1mini.local>
References: <j6f4rcFu3g7U2@mid.individual.net>
Reply-To: g.kreme@gmail.don-t-email-me.com
Injection-Date: Tue, 8 Feb 2022 18:09:37 -0000 (UTC)
Injection-Info: kreme.dont-email.me; posting-host="d2eac48b7aada8e16dc622e914671743";
logging-data="22927"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+Us2t9ejuyFO+CQWjsXfRm"
User-Agent: slrn/1.0.3 (Darwin)
Cancel-Lock: sha1:kAO1TQGoAqq+EuF8fJEtmxmjx4c=
X-Face: )^b5"R:T7U>9~:PEn3YkzMfW*[b1qKeU.fP9C8~8HpU9}lA&6`bH1z
X-Clacks-Overhead: GNU Terry Pratchett
Mail-Copies-To: nobody
 by: Lewis - Tue, 8 Feb 2022 18:09 UTC

In message <j6f4rcFu3g7U2@mid.individual.net> Dr Eberhard Lisse <nospam@lisse.NA> wrote:
> Hi,

> how can a (bash) script find out whether it runs under launchd?

the usual way to see how a script was launched is to check the EUID, but
I am not sure that will tell you with launchd

For example, to check if the script was launched by root:

if [[ $EUID -ne 0 ]]; then
echo "root user required"
exit 1
fi

--
Y'all need to get together and woman up.
I think you mean man up.
No, y'all have been manning up for a while, Look where that's
got you.

Re: script under launchd

<j6jtpoFri67U1@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=13709&group=comp.sys.mac.system#13709

  copy link   Newsgroups: comp.sys.mac.system
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nos...@lisse.NA (Dr Eberhard Lisse)
Newsgroups: comp.sys.mac.system
Subject: Re: script under launchd
Date: Thu, 10 Feb 2022 09:39:33 +0200
Lines: 57
Message-ID: <j6jtpoFri67U1@mid.individual.net>
References: <j6f4rcFu3g7U2@mid.individual.net>
<slrnt05cf0.2lht.g.kreme@m1mini.local>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net bIQSEw+jK81Muq6qyi7vIgmG1G4NItw9jgMIRnhncwVN3R+CDo
Cancel-Lock: sha1:SgyvDGsIJv5CadwxFZWPJrD/ijw=
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.2)
Gecko/20060308 Thunderbird/1.5.0.2 Mnenhy/0.7.4.0
Content-Language: en-US
In-Reply-To: <slrnt05cf0.2lht.g.kreme@m1mini.local>
 by: Dr Eberhard Lisse - Thu, 10 Feb 2022 07:39 UTC

Thank you for answering a question that I did not ask, the answer to
which I knew and was not helpful. Which was unsurprising.

As the script is used by the User (only), $EUID is the same whether
started interactively or by launchd.

However, for those who might be interested, I found that you can easily
put something like

<key>EnvironmentVariables</key>
<dict>
<key>RUNNING_UNDER_LAUNCHD</key>
<string>1</string>
</dict>
</key>

into the plist and then check $RUNNING_UNDER_LAUNCHD.

If yo want to be sure you can set RUNNING_UNDER_LAUNCHD to 0 in .bashrc.

Then of course one can check for $PPID which is 1 if turned loose by
launchd.

And then finally is $XPC_SERVICE_NAME which you (can) set with

<key>Label</key>
<string>na.lisse.whatever.run</string>

in the plist and on an interactive shell is 0.

So, bottom line, RTFM :-)-O

el

On 08/02/2022 20:09, Lewis wrote:
> In message <j6f4rcFu3g7U2@mid.individual.net> Dr Eberhard Lisse
> <nospam@lisse.NA> wrote:
>> Hi,
>
>> how can a (bash) script find out whether it runs under launchd?
>
> the usual way to see how a script was launched is to check the EUID,
> but I am not sure that will tell you with launchd
>
> For example, to check if the script was launched by root:
>
> if [[ $EUID -ne 0 ]]; then
> echo "root user required"
> exit 1
> fi
>

--
To email me replace 'nospam' with 'el'

Re: script under launchd

<slrnt0a9c9.188c.g.kreme@m1mini.local>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=13710&group=comp.sys.mac.system#13710

  copy link   Newsgroups: comp.sys.mac.system
Path: i2pn2.org!i2pn.org!eternal-september.org!reader02.eternal-september.org!kreme.dont-email.me!.POSTED!not-for-mail
From: g.kr...@kreme.dont-email.me (Lewis)
Newsgroups: comp.sys.mac.system
Subject: Re: script under launchd
Date: Thu, 10 Feb 2022 14:47:37 -0000 (UTC)
Organization: Miskatonic U
Lines: 10
Message-ID: <slrnt0a9c9.188c.g.kreme@m1mini.local>
References: <j6f4rcFu3g7U2@mid.individual.net>
<slrnt05cf0.2lht.g.kreme@m1mini.local> <j6jtpoFri67U1@mid.individual.net>
Reply-To: g.kreme@gmail.don-t-email-me.com
Injection-Date: Thu, 10 Feb 2022 14:47:37 -0000 (UTC)
Injection-Info: kreme.dont-email.me; posting-host="2840adecdb4823e985828cccb12d7783";
logging-data="9193"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19jddpkgeFqXqb6DoJ7utTr"
User-Agent: slrn/1.0.3 (Darwin)
Cancel-Lock: sha1:7zgpG6kmFdiMDM8Caaw89V6q5n0=
X-Face: )^b5"R:T7U>9~:PEn3YkzMfW*[b1qKeU.fP9C8~8HpU9}lA&6`bH1z
X-Clacks-Overhead: GNU Terry Pratchett
Mail-Copies-To: nobody
 by: Lewis - Thu, 10 Feb 2022 14:47 UTC

In message <j6jtpoFri67U1@mid.individual.net> Dr Eberhard Lisse <nospam@lisse.NA> wrote:
> Thank you for answering a question that I did not ask, the answer to
> which I knew and was not helpful. Which was unsurprising.

I apologize for attempting to help you. It will not ever happen again.

--
I don't believe there's a power in the 'verse can stop Kaylee from
bein' cheerful. Sometimes you just wanna duct-tape her mouth and
dump her in the hold for a month.

Re: script under launchd

<j6msgbFea0cU1@mid.individual.net>

  copy mid

https://www.novabbs.com/computers/article-flat.php?id=13711&group=comp.sys.mac.system#13711

  copy link   Newsgroups: comp.sys.mac.system
Path: i2pn2.org!i2pn.org!news.swapon.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From: nos...@lisse.NA (Dr Eberhard Lisse)
Newsgroups: comp.sys.mac.system
Subject: Re: script under launchd
Date: Fri, 11 Feb 2022 12:35:54 +0200
Lines: 15
Message-ID: <j6msgbFea0cU1@mid.individual.net>
References: <j6f4rcFu3g7U2@mid.individual.net>
<slrnt05cf0.2lht.g.kreme@m1mini.local> <j6jtpoFri67U1@mid.individual.net>
<slrnt0a9c9.188c.g.kreme@m1mini.local>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: individual.net i/FQneFR08zYB2YAOHrzzgoiiy4Zcs5lTbgMm7tmbTm5rdiZ2B
Cancel-Lock: sha1:F4+0XB0dGAiSl1eI+HpdAv/dZwE=
User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8.0.2)
Gecko/20060308 Thunderbird/1.5.0.2 Mnenhy/0.7.4.0
Content-Language: en-US
In-Reply-To: <slrnt0a9c9.188c.g.kreme@m1mini.local>
 by: Dr Eberhard Lisse - Fri, 11 Feb 2022 10:35 UTC

Never happened before either.

el

On 10/02/2022 16:47, Lewis wrote:
> In message <j6jtpoFri67U1@mid.individual.net> Dr Eberhard Lisse <nospam@lisse.NA> wrote:
>> Thank you for answering a question that I did not ask, the answer to
>> which I knew and was not helpful. Which was unsurprising.
>
> I apologize for attempting to help you. It will not ever happen
> again.
>

--
To email me replace 'nospam' with 'el'

1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor