Re: [systemd-devel] Is there a way to see if a script is run from systemd

2016-05-08 Thread Kai Krakow
Am Sun, 8 May 2016 13:05:34 +0200
schrieb Reindl Harald :

> Am 07.05.2016 um 15:00 schrieb Cecil Westerhof:
> > I have written a Bash script to be used for a service. Is it
> > possible to see in the script if it is run from systemd? I could
> > use this for debugging purposes  
> 
> just set a environment variable in the systemd unit or check against
> a lot of env-vars missing which are there in a ordinary shell but
> removed from systemd to start with a clean anvironement

Probably it would also work to look at $PPID which should be 1 if
running under systemd - I have not tried that, tho.

But keep in mind that this may not be systemd-specific. And, if you
daemonize, the parent may switch to 1.

-- 
Regards,
Kai

Replies to list-only preferred.


pgpDoDKHQQHaW.pgp
Description: Digitale Signatur von OpenPGP
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Is there a way to see if a script is run from systemd

2016-05-08 Thread Reindl Harald



Am 07.05.2016 um 15:00 schrieb Cecil Westerhof:

I have written a Bash script to be used for a service. Is it possible to
see in the script if it is run from systemd? I could use this for
debugging purposes


just set a environment variable in the systemd unit or check against a 
lot of env-vars missing which are there in a ordinary shell but removed 
from systemd to start with a clean anvironement




signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Let journalctl give only output of script

2016-05-08 Thread Tomasz Torcz
On Sat, May 07, 2016 at 12:47:45PM +0200, Cecil Westerhof wrote:
> I made my own service and I can get info about it with:
> ​journalctl -u firefoxCPUUsageStore​
> 
> ​But this gives also info about starting, restarting and the like. Is it
> possible to get only the logging that is generated by the script itself?​
> 

  Use
journalctl _SYSTEMD_UNIT=firefoxCPUUsageStore.service

 Nb. if you use ”-o export” you will see all the fields stored in journal,
so you will be able to choose on which fields you should filter.

-- 
Tomasz TorczThere exists no separation between gods and men:
xmpp: zdzich...@chrome.pl   one blends softly casual into the other.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Is there a way to see if a script is run from systemd

2016-05-08 Thread Cecil Westerhof
I have written a Bash script to be used for a service. Is it possible to
see in the script if it is run from systemd? I could use this for debugging
purposes.

-- 
Cecil Westerhof
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Let journalctl give only output of script

2016-05-08 Thread Cecil Westerhof
I made my own service and I can get info about it with:
​journalctl -u firefoxCPUUsageStore​

​But this gives also info about starting, restarting and the like. Is it
possible to get only the logging that is generated by the script itself?​

-- 
Cecil Westerhof
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel