0

I want to run a service on linux on reboot. I know i can do

sudo systemctl enable service_name.service

To run this service on reboot. But I can't use terminal. So, Is there any way that i could run this service on reboot without the help of terminal.

I mean that command would also did some changes to any files or location. So, i will make changes to those locations. If still you have any doubt you may ask me , but please tell.

1
  • You may give me any command which don't need sudo priviledge to run
    – MR. David
    Jan 13, 2023 at 16:31

1 Answer 1

0

Running sudo systemctl enable service_name.service would create a symbolic link in the directory of the target specified in the [Install] section of the service file. Most commonly the directory will be /etc/systemd/system/multi-user.target.wants/. The link will be named service_name.service and pointing to the actual location of the file service_name.service.

In other words, if service_name.service is located at /usr/lib/systemd/system/service_name.service and its [Install] section says WantedBy=multi-user.target, the equivalent basic command would be:

ln -s /usr/lib/systemd/system/service_name.service /etc/systemd/system/multi-user.target.wants/service_name.service

If you can perform the equivalent of that action as root, with whatever unspecified tools you have available, it will be effectively the same as running systemctl enable service_name.service.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .