I have placed a systemd service file in usr/lib/systemd/system/testfile.service
.
Here is the service file:
[Unit]
Description=Test service
[Service]
Type=notify
ExecStart=/bin/dd.sh
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=30s
[Install]
WantedBy=multi-user.target
I tried to start the service at boot time by trying these two ways
- Created a softlink for the file from
/usr/lib/systemd/systemd
to/etc/systemd/system/multi-user.target.wants
(manually and by using systemctl enable command) and rebooted the system, testfile service started successfully at boot time . - created a dependency in the existing up and running service file like
After=testfile.service
andWants=testfile.service
, then rebooted the system testfile service started successfully.
But when I place the file /usr/lib/systemd/system
and without any 1 or 2 solution approach service is not started, I feel that placing the service file in /usr/lib/systemd/system/ is enough for any service to start automatically , without creating the softlinks to wants directory or creating the dependency with the other services.
Please let me know, how to start a service at boot time which is present in /usr/lib/systemd/system
directory without 1 or 2 solution approaches?
I have also created preset files in usr/lib/systemd/system-preset/ to disable and enable few services, seems like those preset files were not executed , services which i have disabled in the preset file are still enabled after the boot up. Please let me know how to debug this issue.