I am trying to run my custom service using systemctl, but it alwasy gave me error:
Oct 29 14:09:30 ip-10-0-0-215.ap-southeast-1.compute.internal systemd[12402]: Failed at step USER spawning /home/ec2-user/zuul/target/zuul.jar: No such process
Oct 29 14:09:30 ip-10-0-0-215.ap-southeast-1.compute.internal systemd[1]: zuul.service: main process exited, code=exited, status=217/USER
Oct 29 14:09:30 ip-10-0-0-215.ap-southeast-1.compute.internal systemd[1]: Unit zuul.service entered failed state.
Oct 29 14:09:30 ip-10-0-0-215.ap-southeast-1.compute.internal systemd[1]: zuul.service failed.
the configuration in zuul.service:
[Unit]
Description=leave service
[Service]
User=ec2-user
# The configuration file application.properties should be here:
#change this to your workspace
WorkingDirectory=/home/ec2-user
#path to executable.
#executable is a bash script which calls jar file
ExecStart=/home/ec2-user/project-error-404/microservice/leaveService/target/leaveService.jar
SuccessExitStatus=143
TimeoutStopSec=10
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
how i run the service is:
sudo systemctl daemon-reload
sudo systemctl enable zuul.service
sudo systemctl start zuul
I have tried remove user from the service file but it does not help. I am sure that the owner of the file and directory is ec2-user. And with the same configuration, it can run on my other instances. But i have spent hours on this and i had no solution.