Discussion:
systemd + ExecStart + python script
(too old to reply)
Abdelghani Ouchabane
2013-11-11 15:55:05 UTC
Permalink
Hallo,
I have two systemd files: ezono-cyclades-t_idl.path &
ezono-cyclades-t_idl.service ( I am using systemd 204 ), xxx.path
triggers xxxx.service

And I am launching the main program as:

ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.pyo

Or

ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.py

The problem is that systemd is keeping starting
ezono-cyclades-t_idl.service even after the unit starts. You can see the
appearance of "Started ezono-cyclades-t_idl Service" many times in the
below log. I tried many options but unfortunately I could not fix it.
The problem here is that I have many other units and keeping starting
this unit is causing problems for the other units. i doubt that the root
of the problem is the python script!!

It will be great if you can help me to find a solution.


Many thanks in advance.

Regards
Abdelghani



Here is the log:

ezono-cyclades-t_idl.service - ezono-cyclades-t_idl Service
Loaded: loaded
(/usr/lib/systemd/system/ezono-cyclades-t_idl.service; static)
Active: active (running) since Mon 2013-11-11 16:35:06 CET; 11min ago
Main PID: 1377 (sh)
CGroup: name=systemd:/system/ezono-cyclades-t_idl.service
|-1377 /bin/sh -c if [ ! -e /home/x/taskconfig/screensaver
]; then /bin/mkdir -p /home/x/taskconfig ;
/bin/cp /opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi
; /bin/echo -n $BASHPID >
/var/tmp/cyclades_services/IDL/pid ; DISPLAY=:0 CYCLADES_ERR=IDL
/opt/cyclades/bin/logger.sh -c "/usr/bin/python
/opt/cyclades/bin/t_idl.pyo" -p err -t IDL
|-1433 /bin/sh -c if [ ! -e /home/x/taskconfig/screensaver
]; then /bin/mkdir -p /home/x/taskconfig ;
/bin/cp /opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi
; /bin/echo -n $BASHPID >
/var/tmp/cyclades_services/IDL/pid ; DISPLAY=:0 CYCLADES_ERR=IDL
/opt/cyclades/bin/logger.sh -c "/usr/bin/python
/opt/cyclades/bin/t_idl.pyo" -p err -t IDL
|-1550 /usr/bin/python /opt/cyclades/bin/t_idl.pyo
`-1551 logger -p local4.err -t IDL --

Nov 11 16:35:12 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:12 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:12 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:14 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:14 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:14 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:14 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:16 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:18 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 16:35:32 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Zbigniew Jędrzejewski-Szmek
2013-11-11 16:32:01 UTC
Permalink
Post by Abdelghani Ouchabane
ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.pyo
|-1377 /bin/sh -c if [ ! -e
/home/x/taskconfig/screensaver ]; then /bin/mkdir -p
/home/x/taskconfig ; /bin/cp
/opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi ;
/bin/echo -n $BASHPID > /var/tmp/cyclades_services/IDL/pid ;
DISPLAY=:0 CYCLADES_ERR=IDL /opt/cyclades/bin/logger.sh -c
"/usr/bin/python /opt/cyclades/bin/t_idl.pyo" -p err -t IDL
Those two don't correspond. Either you're starting the program
directly, or through some shell scripts. It would help if you
showed the two unit files.

Zbyszek
Abdelghani Ouchabane
2013-11-11 16:45:29 UTC
Permalink
Post by Zbigniew Jędrzejewski-Szmek
Post by Abdelghani Ouchabane
ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.pyo
|-1377 /bin/sh -c if [ ! -e
/home/x/taskconfig/screensaver ]; then /bin/mkdir -p
/home/x/taskconfig ; /bin/cp
/opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi ;
/bin/echo -n $BASHPID > /var/tmp/cyclades_services/IDL/pid ;
DISPLAY=:0 CYCLADES_ERR=IDL /opt/cyclades/bin/logger.sh -c
"/usr/bin/python /opt/cyclades/bin/t_idl.pyo" -p err -t IDL
Those two don't correspond. Either you're starting the program
directly, or through some shell scripts. It would help if you
showed the two unit files.
Zbyszek
Hi Zbyszek,
thanks a lot for your quick replay.

I am sorry that I send a modified script. Well here is the right one:

Regards


ezono-cyclades-t_idl.service:

.include /usr/lib/systemd/system/ezono-cyclades-user-x-settings.service

[Unit]
Description=ezono-cyclades-t_idl Service
Conflicts=ezono-cyclades-emergency-stop.service
ezono-cyclades-stop-tasks.service

ConditionPathExists=!/tmp/emergency

ConditionPathExists=|/opt/cyclades/etc/end-user
ConditionPathExists=|/opt/cyclades/etc/development-system

[Service]
Type=simple
WorkingDirectory=/tmp
SuccessExitStatus=0

#Set the configuration file
ExecStartPre=/bin/sh -c 'if [ ! -e /home/x/taskconfig/screensaver ]; then \
/bin/mkdir -p /home/x/taskconfig ; \
/bin/cp
/opt/cyclades/etc/taskconfig/screensaver /home/x/taskconfig/screensaver ; \
fi'

ExecStartPre=/bin/echo -n $BASHPID > /var/tmp/cyclades_services/IDL/pid

ExecStart=/bin/sh -c 'DISPLAY=:0 CYCLADES_ERR=IDL
/opt/cyclades/bin/logger.sh -c \"/usr/bin/python
/opt/cyclades/bin/t_idl.pyo\" -p err -t IDL'

ExecStop=/bin/sh -c '[ ! -f /opt/cyclades/etc/systemd-debug ] || logger
-p local4.debug -t SYSTEMD Unit IDL stopping...'
ExecStop=/bin/touch /tmp/cyclades/stoptask.IDL

ExecStopPost=/bin/sh -c '[ ! -f /opt/cyclades/etc/systemd-debug ] ||
logger -p local4.debug -t SYSTEMD Unit IDL stopped'

Restart=on-failure
#RestartSec=1

TimeoutStopSec=30

#Limit restarting to 2 times in 30 seconds
StartLimitBurst=2
StartLimitInterval=30



Logs:



[***@sonostation-usb12-eth system]# systemctl status
ezono-cyclades-t_idl.service
ezono-cyclades-t_idl.service - ezono-cyclades-t_idl Service
Loaded: loaded
(/usr/lib/systemd/system/ezono-cyclades-t_idl.service; static)
Active: active (running) since Mon 2013-11-11 17:42:57 CET; 2min 3s ago
Process: 1562 ExecStartPre=/bin/echo -n $BASHPID >
/var/tmp/cyclades_services/IDL/pid (code=exited, status=0/SUCCESS)
Process: 1512 ExecStartPre=/bin/sh -c if [ ! -e
/home/x/taskconfig/screensaver ]; then /bin/mkdir -p /home/x/taskconfig
; /bin/cp /opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi
(code=exited, status=0/SUCCESS)
Main PID: 1590 (sh)
CGroup: name=systemd:/system/ezono-cyclades-t_idl.service
|-1590 /bin/sh -c DISPLAY=:0 CYCLADES_ERR=IDL
/opt/cyclades/bin/logger.sh -c "/usr/bin/python
/opt/cyclades/bin/t_idl.pyo" -p ...
|-1642 /usr/bin/python /opt/cyclades/bin/t_idl.pyo
`-1643 logger -p local4.err -t IDL --

Nov 11 17:43:02 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:03 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:03 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:05 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:05 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:05 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:07 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:09 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:21 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 11 17:43:24 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Abdelghani Ouchabane
2013-11-12 17:14:30 UTC
Permalink
Post by Zbigniew Jędrzejewski-Szmek
Post by Abdelghani Ouchabane
ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.pyo
|-1377 /bin/sh -c if [ ! -e
/home/x/taskconfig/screensaver ]; then /bin/mkdir -p
/home/x/taskconfig ; /bin/cp
/opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi ;
/bin/echo -n $BASHPID > /var/tmp/cyclades_services/IDL/pid ;
DISPLAY=:0 CYCLADES_ERR=IDL /opt/cyclades/bin/logger.sh -c
"/usr/bin/python /opt/cyclades/bin/t_idl.pyo" -p err -t IDL
Those two don't correspond. Either you're starting the program
directly, or through some shell scripts. It would help if you
showed the two unit files.
Zbyszek
Hallo Zbyszek,
I modified the unit to start the main program as:

1- ExecStart=/bin/sh -c 'DISPLAY=:0 /usr/bin/python
/opt/cyclades/bin/t_idl.pyo'

Results:
ezono-cyclades-t_idl.service - ezono-cyclades-t_idl Service
Loaded: loaded
(/usr/lib/systemd/system/ezono-cyclades-t_idl.service; static)
Active: active (running) since Tue 2013-11-12 17:49:59 CET; 3min 16s ago
Process: 1335 ExecStartPre=/bin/echo -n $BASHPID >
/var/tmp/cyclades_services/IDL/pid (code=exited, status=0/SUCCESS)
Process: 1316 ExecStartPre=/bin/sh -c if [ ! -e
/home/x/taskconfig/screensaver ]; then /bin/mkdir -p /home/x/taskconfig
; /bin/cp /opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi
(code=exited, status=0/SUCCESS)
Main PID: 1378 (python)
CGroup: name=systemd:/system/ezono-cyclades-t_idl.service
`-1378 /usr/bin/python /opt/cyclades/bin/t_idl.pyo

Nov 12 17:50:05 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:50:07 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:50:07 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:50:08 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:50:08 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:50:09 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:50:11 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:50:11 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:50:25 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 17:52:23 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.

2- ExecStart=/bin/sh -c '/opt/run-t_idl.sh'

where:
/opt/run-t_idl.sh contains : DISPLAY=:0 /usr/bin/python
/opt/cyclades/bin/t_idl.pyo

Results:
ezono-cyclades-t_idl.service - ezono-cyclades-t_idl Service
Loaded: loaded
(/usr/lib/systemd/system/ezono-cyclades-t_idl.service; static)
Active: active (running) since Tue 2013-11-12 18:07:18 CET; 9s ago
Process: 1478 ExecStartPre=/bin/echo -n $BASHPID >
/var/tmp/cyclades_services/IDL/pid (code=exited, status=0/SUCCESS)
Process: 1449 ExecStartPre=/bin/sh -c if [ ! -e
/home/x/taskconfig/screensaver ]; then /bin/mkdir -p /home/x/taskconfig
; /bin/cp /opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi
(code=exited, status=0/SUCCESS)
Main PID: 1550 (sh)
CGroup: name=systemd:/system/ezono-cyclades-t_idl.service
|-1550 /bin/sh -c /opt/run-t_idl.sh
`-1556 /usr/bin/python /opt/cyclades/bin/t_idl.pyo

Nov 12 18:07:23 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:23 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:23 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:23 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:24 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:25 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:25 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:26 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:26 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.
Nov 12 18:07:28 sonostation-usb12-eth.ezono.net systemd[1]: Started
ezono-cyclades-t_idl Service.



It looks that systemd doesn't track python script properly or my python
script is doing something strange.


Regards
Ghani
Zbigniew Jędrzejewski-Szmek
2013-11-12 17:40:34 UTC
Permalink
Post by Abdelghani Ouchabane
Post by Zbigniew Jędrzejewski-Szmek
Post by Abdelghani Ouchabane
ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.pyo
|-1377 /bin/sh -c if [ ! -e
/home/x/taskconfig/screensaver ]; then /bin/mkdir -p
/home/x/taskconfig ; /bin/cp
/opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi ;
/bin/echo -n $BASHPID > /var/tmp/cyclades_services/IDL/pid ;
DISPLAY=:0 CYCLADES_ERR=IDL /opt/cyclades/bin/logger.sh -c
"/usr/bin/python /opt/cyclades/bin/t_idl.pyo" -p err -t IDL
Those two don't correspond. Either you're starting the program
directly, or through some shell scripts. It would help if you
showed the two unit files.
Zbyszek
Hallo Zbyszek,
1- ExecStart=/bin/sh -c 'DISPLAY=:0 /usr/bin/python
/opt/cyclades/bin/t_idl.pyo'
Try something simpler:

Environment=DISPLAY=:0
ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.pyo

Anyway, it seems that the script either exits (maybe some error?) or
daemonizes itself. If it's not failing to start with an error, you
probably need to change (starting from the snippet I put above) to
Type=forking, or make the script not exit.

Zbyszek
Abdelghani Ouchabane
2013-11-18 16:56:47 UTC
Permalink
Post by Zbigniew Jędrzejewski-Szmek
Post by Abdelghani Ouchabane
Post by Zbigniew Jędrzejewski-Szmek
Post by Abdelghani Ouchabane
ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.pyo
|-1377 /bin/sh -c if [ ! -e
/home/x/taskconfig/screensaver ]; then /bin/mkdir -p
/home/x/taskconfig ; /bin/cp
/opt/cyclades/etc/taskconfig/screensaver
/home/x/taskconfig/screensaver ; fi ;
/bin/echo -n $BASHPID > /var/tmp/cyclades_services/IDL/pid ;
DISPLAY=:0 CYCLADES_ERR=IDL /opt/cyclades/bin/logger.sh -c
"/usr/bin/python /opt/cyclades/bin/t_idl.pyo" -p err -t IDL
Those two don't correspond. Either you're starting the program
directly, or through some shell scripts. It would help if you
showed the two unit files.
Zbyszek
Hallo Zbyszek,
1- ExecStart=/bin/sh -c 'DISPLAY=:0 /usr/bin/python
/opt/cyclades/bin/t_idl.pyo'
Environment=DISPLAY=:0
ExecStart=/usr/bin/python /opt/cyclades/bin/t_idl.pyo
Anyway, it seems that the script either exits (maybe some error?) or
daemonizes itself. If it's not failing to start with an error, you
probably need to change (starting from the snippet I put above) to
Type=forking, or make the script not exit.
Zbyszek
Hi Zbyszek,
thanks a lot for your great help, the problem was in
ezono-cyclades-t_idl.path, it contained the following:

[Unit]
Description=ezono-cyclades-t_idl Service Spool

[Path]
PathChanged=/tmp/cyclades/restart-t_idl
PathExists=/tmp/cyclades/start-ezono-cyclades-gui

[Install]
WantedBy=ezono-cyclades.target



And /tmp/cyclades/start-ezono-cyclades-gui is created during the boot
but /tmp/cyclades/restart-t_idl is never created, this was making the
ezono-cyclades-t_idl.service keeps restarting, after I removed
"PathChanged=/tmp/cyclades/restart-t_idl", the behavior becomes correct.
Zbigniew Jędrzejewski-Szmek
2013-11-18 18:24:58 UTC
Permalink
On Mon, Nov 18, 2013 at 05:56:47PM +0100, Abdelghani Ouchabane wrote:
Abdelghani Ouchabane
2013-11-19 08:55:01 UTC
Permalink
Zbigniew Jędrzejewski-Szmek
2013-11-11 16:35:22 UTC
Permalink
Post by Abdelghani Ouchabane
Hallo,
I have two configuration files: ezono-cyclades-t_upn.path &
ezono-cyclades-t_upn.service
[Unit]
Description=ezono-cyclades-t_upn Service Spool
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
[Path]
PathExists=/tmp/cyclades/start-ezono-cyclades-gui
[Install]
WantedBy=ezono-cyclades.target
The problem is that by passing "DefaultDependencies=no"
ezono-cyclades-t_upn.service doesn't start after
/tmp/cyclades/start-ezono-cyclades-gui is created, even after all
other units run and I delete /tmp/cyclades/start-ezono-cyclades-gui
and create it again.
Any idea please.
Is ezono-cyclaed.target enabled?

Also, DefaultDependencies=no is very unlikely to be what you need.

Also, /tmp/cyclades is subject to "predicatable paths in /tmp" attack.
You should use a file in /run/.

Zbyszek
Abdelghani Ouchabane
2013-11-11 16:50:51 UTC
Permalink
Post by Zbigniew Jędrzejewski-Szmek
Post by Abdelghani Ouchabane
Hallo,
I have two configuration files: ezono-cyclades-t_upn.path &
ezono-cyclades-t_upn.service
[Unit]
Description=ezono-cyclades-t_upn Service Spool
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
[Path]
PathExists=/tmp/cyclades/start-ezono-cyclades-gui
[Install]
WantedBy=ezono-cyclades.target
The problem is that by passing "DefaultDependencies=no"
ezono-cyclades-t_upn.service doesn't start after
/tmp/cyclades/start-ezono-cyclades-gui is created, even after all
other units run and I delete /tmp/cyclades/start-ezono-cyclades-gui
and create it again.
Any idea please.
Is ezono-cyclaed.target enabled?
Yes

ezono-cyclades.target - eZono Cyclades GUI
Loaded: loaded (/usr/lib/systemd/system/ezono-cyclades.target; enabled)
Active: active since Mon 2013-11-11 17:48:43 CET; 23s ago

Nov 11 17:48:43 sonostation-usb12-eth.ezono.net systemd[1]: Starting
eZono Cyclades GUI.
Nov 11 17:48:43 sonostation-usb12-eth.ezono.net systemd[1]: Reached
target eZono Cyclades GUI.
Post by Zbigniew Jędrzejewski-Szmek
Also, DefaultDependencies=no is very unlikely to be what you need.
I want to start ezono-cyclades-t_upn.path early as I can
Post by Zbigniew Jędrzejewski-Szmek
Also, /tmp/cyclades is subject to "predicatable paths in /tmp" attack.
You should use a file in /run/.
Zbyszek
Thanks
Zbigniew Jędrzejewski-Szmek
2013-11-11 17:23:45 UTC
Permalink
Post by Abdelghani Ouchabane
Post by Zbigniew Jędrzejewski-Szmek
Post by Abdelghani Ouchabane
Hallo,
I have two configuration files: ezono-cyclades-t_upn.path &
ezono-cyclades-t_upn.service
[Unit]
Description=ezono-cyclades-t_upn Service Spool
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
[Path]
PathExists=/tmp/cyclades/start-ezono-cyclades-gui
[Install]
WantedBy=ezono-cyclades.target
The problem is that by passing "DefaultDependencies=no"
ezono-cyclades-t_upn.service doesn't start after
/tmp/cyclades/start-ezono-cyclades-gui is created, even after all
other units run and I delete /tmp/cyclades/start-ezono-cyclades-gui
and create it again.
Any idea please.
Is ezono-cyclaed.target enabled?
Yes
ezono-cyclades.target - eZono Cyclades GUI
Loaded: loaded (/usr/lib/systemd/system/ezono-cyclades.target; enabled)
Active: active since Mon 2013-11-11 17:48:43 CET; 23s ago
Nov 11 17:48:43 sonostation-usb12-eth.ezono.net systemd[1]: Starting
eZono Cyclades GUI.
Nov 11 17:48:43 sonostation-usb12-eth.ezono.net systemd[1]: Reached
target eZono Cyclades GUI.
The condition is only checked once, when the unit is started. I'd guess
that whatever creates /tmp/cyclades/start-ezono-cyclades-gui, does it
after the ezono-cyclades-t_upn.service/start job has already been done.
The condition will not be checked again unless you restart the servcie.
Post by Abdelghani Ouchabane
Post by Zbigniew Jędrzejewski-Szmek
Also, DefaultDependencies=no is very unlikely to be what you need.
I want to start ezono-cyclades-t_upn.path early as I can
That's not very convicing. I have no idea what it does, but
DefaultDependencies=no is only appropriate for services which
participate in bringing up the system.

Units that you show are very very complex, but it's unlikely that this
is all needed. E.g. don't implement your own strange logging
solutions, just start systemd with --log-level=debug and you'll get
full information about what is started and when. Also output from
services is logged to the journal by default.
Post by Abdelghani Ouchabane
Post by Zbigniew Jędrzejewski-Szmek
Also, /tmp/cyclades is subject to "predicatable paths in /tmp" attack.
You should use a file in /run/.
Zbyszek
Thanks
Zbyszek
Abdelghani Ouchabane
2013-11-13 14:39:48 UTC
Permalink
<html>
<head>
<meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">On 11/11/13 18:23, Zbigniew
Jędrzejewski-Szmek wrote:<br>
</div>
<blockquote cite="mid:***@in.waw.pl" type="cite">
<pre wrap="">On Mon, Nov 11, 2013 at 05:50:51PM +0100, Abdelghani Ouchabane wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On 11/11/13 17:35, Zbigniew Jędrzejewski-Szmek wrote:
</pre>
<blockquote type="cite">
<pre wrap="">On Mon, Nov 11, 2013 at 05:26:28PM +0100, Abdelghani Ouchabane wrote:
</pre>
<blockquote type="cite">
<pre wrap="">Hallo,
I have two configuration files: ezono-cyclades-t_upn.path &amp;
ezono-cyclades-t_upn.service


Where:

ezono-cyclades-t_upn.path :

[Unit]
Description=ezono-cyclades-t_upn Service Spool
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target

[Path]
PathExists=/tmp/cyclades/start-ezono-cyclades-gui

[Install]
WantedBy=ezono-cyclades.target


The problem is that by passing "DefaultDependencies=no"
ezono-cyclades-t_upn.service doesn't start after
/tmp/cyclades/start-ezono-cyclades-gui is created, even after all
other units run and I delete /tmp/cyclades/start-ezono-cyclades-gui
and create it again.

Any idea please.
</pre>
</blockquote>
<pre wrap="">Is ezono-cyclaed.target enabled?
</pre>
</blockquote>
<pre wrap="">Yes

ezono-cyclades.target - eZono Cyclades GUI
Loaded: loaded (/usr/lib/systemd/system/ezono-cyclades.target; enabled)
Active: active since Mon 2013-11-11 17:48:43 CET; 23s ago

Nov 11 17:48:43 sonostation-usb12-eth.ezono.net systemd[1]: Starting
eZono Cyclades GUI.
Nov 11 17:48:43 sonostation-usb12-eth.ezono.net systemd[1]: Reached
target eZono Cyclades GUI.
</pre>
</blockquote>
<pre wrap="">The condition is only checked once, when the unit is started. I'd guess
that whatever creates /tmp/cyclades/start-ezono-cyclades-gui, does it
after the ezono-cyclades-t_upn.service/start job has already been done.
The condition will not be checked again unless you restart the servcie.</pre>
</blockquote>
Thanks Zbigniew<br>
<br>
I confirm that, the condition is checked only after I execute :
systemctl daemon-reload<br>
<br>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<blockquote cite="mid:***@in.waw.pl" type="cite">
<pre wrap="">

</pre>
<blockquote type="cite">
<blockquote type="cite">
<pre wrap="">Also, DefaultDependencies=no is very unlikely to be what you need.
</pre>
</blockquote>
<pre wrap="">I want to start ezono-cyclades-t_upn.path early as I can
</pre>
</blockquote>
<pre wrap="">That's not very convicing. I have no idea what it does, but
DefaultDependencies=no is only appropriate for services which
participate in bringing up the system.</pre>
</blockquote>
Right, I have two services which deal with hardware devices, and
they start early properly.<br>
<br>
<blockquote cite="mid:***@in.waw.pl" type="cite">
<pre wrap="">

Units that you show are very very complex, but it's unlikely that this
is all needed. E.g. don't implement your own strange logging
solutions, just start systemd with --log-level=debug and you'll get
full information about what is started and when. Also output from
services is logged to the journal by default.</pre>
</blockquote>
I am planning to remove my logging solutions and use the systemd
built-in.<br>
<br>
Thanks<br>
</body>
</html>
Continue reading on narkive:
Loading...