A conversão de upstart para systemd não funciona para enrolar e assistir?

1

Eu tive esse trabalho inicial antes:

description "This is Notification Service"
author "King"

start on runlevel [2345]
exec watch -n 1 /usr/bin/curl -s https://domain.com/cron >/dev/null 2>&1

Agora, converti para systemd:

[Unit]
Description=This is Notification Service

[Service]
ExecStart=/bin/bash -c '/usr/bin/watch -n 1 /usr/bin/curl -s https://domain.com/cron >/dev/null 2>&1'


[Install]
WantedBy=multi-user.target

Mas não está funcionando, sempre falha quando eu inicio.

● notify-fb.service - This is Notification Service
   Loaded: loaded (/etc/systemd/system/notify-fb.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sun 2016-09-25 02:25:02 PST; 3h 53min ago
  Process: 15299 ExecStart=/usr/bin/watch -n 1 /usr/bin/curl -s https://domain.com/cron (code=exited, status=1/FAILURE)
 Main PID: 15299 (code=exited, status=1/FAILURE)

Sep 25 02:25:02 xxxx.com systemd[1]: Started This is Notification Service.
Sep 25 02:25:02 xxxx.com watch[15299]: Error opening terminal: unknown.
Sep 25 02:25:02 xxxx.com systemd[1]: notify-fb.service: Main process exited, code=exited, status=1/FAILURE
Sep 25 02:25:02 xxxx.com systemd[1]: notify-fb.service: Unit entered failed state.
Sep 25 02:25:02 xxxx.com systemd[1]: notify-fb.service: Failed with result 'exit-code'.
    
por Thomas Coulson 25.09.2016 / 02:35

1 resposta

1

Na sua saída, há:

  

watch [15299]: Erro ao abrir o terminal: desconhecido.

Parece que watch está esperando se conectar a um TTY no STDOUT, mas está falhando. Consulte os documentos para StandardOutput= in systemd.exec para opções a serem definidas o TTY.

O

systemd também pode substituir a necessidade de usar o "watch" completamente. Parece que watch está simplesmente chamando a URL uma vez por segundo. A mesma coisa pode ser realizada com um temporizador systemd. Veja man systemd.timer e man systemd.time para aprender sobre os temporizadores do systemd.

    
por Mark Stosberg 26.09.2016 / 21:28