systemctl status shows inactive dead

后端 未结 2 685
时光取名叫无心
时光取名叫无心 2021-02-02 12:18

I am trying to write my own (simple) systemd service which does something simple.( Like writing numbers 1 to 10 to a file, using the shell script). My service file looks like be

相关标签:
2条回答
  • 2021-02-02 13:15
    • You have set Type=Forking, but your service doesn't work. Try Type=oneshot
    • You have a "&" your ExecStart line, which is not necessary.
    • The service is disabled, which means it was not enabled to start at boot. You should run systemctl enable hello to set it to start at boot.

    You can check man systemd.directives to find an index of all the directives that you can use in your unit files.

    0 讨论(0)
  • 2021-02-02 13:16

    Few points:

    1. If you use Type=forking, it is recommended to specify PidFile.

    2. In your case, Type=simple, and ExecStart without & will work.

    3. use systemctl start service-name to start a service

    4. Then use systemctl status service-name to check its status. status will be inactive/dead if service is not started.

    0 讨论(0)
提交回复
热议问题