[systemd-devel] systemd + ExecStart + python script
Abdelghani Ouchabane
abdelghani at ezono.com
Mon Nov 11 08:45:29 PST 2013
On 11/11/13 17:32, Zbigniew Jędrzejewski-Szmek wrote:
> On Mon, Nov 11, 2013 at 04:55:05PM +0100, Abdelghani Ouchabane wrote:
>> 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:
[root at 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.
More information about the systemd-devel
mailing list