I have a service I want to run right after my computer start.
The steps I've followed for it are as follows:
Create cv
- Create cv-init.service in /usr/lib/systemd/system
- Format the file as shown below
- sudo systemctl daemon-reload
- sudo systemctl start cv-init.service
- sudo systemctl enable cv-init.service
When I run the enable command for the first time, I get this response:
Created symlink /etc/systemd/system/multi-user.target.wants/cv-init.service -> /usr/lib/systemd/system/cv-init.service
If I run the enable commands again, I get no response, I have to delete the symlink in multi-user-target-wants before it shows again.
As many other cases I've read from people having trouble with it, if I manually execute the service, it works, and though enabling is successful, when I restart my computer, it does not execute.
Here is my service file:
[Unit]
Description=Initialize CV
[Service]
Type=oneshot
WorkingDirectory=/app/configuration/cv_init
ExecStart=/app/configuration/cv_init/startup_cv.sh
[Install]
WantedBy=multi-user.target
I think its important to say that startup_cv.sh is not a script that keeps the daemon active, it just runs some commands that reads some logs and take some other actions, if I run the .sh file manually it works as intended, I just can't seem to make it work automatically on startup.
I've also tried many things that seem to have worked for people asking this kind of question like placing my service in /etc/init.d or in /etc/systemd/system, also specifying WANTS and those kind of things on my service, but it still doesn't work, could anyone lend me a hand?
systemctl status cv-init.service
. No sudo needed. Ensure your terminal window is wide enough to see all the output.