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
Type=Forking
, but your service doesn't work. Try
Type=oneshot
ExecStart
line, which is not necessary. 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.
Few points:
If you use Type=forking
, it is recommended to specify PidFile.
In your case, Type=simple
, and ExecStart without &
will work.
use systemctl start service-name
to start a service
Then use systemctl status service-name
to check its status.
status will be inactive/dead if service is not started.