Cog-Creators / Red-DiscordBot

A multi-function Discord bot
https://docs.discord.red
GNU General Public License v3.0
4.72k stars 2.3k forks source link

Update autostart_systemd.rst #6296

Closed pablo8itall closed 6 months ago

pablo8itall commented 6 months ago

When creating the name of the of the systemd file you need to add the instance name after the @ symbol, e.g. red@MyInstance.service, as the service file uses the %I for this information.

Description of the changes

added some text explaining that the instance name needs to be used when naming the file.

Have the changes in this PR been tested?

Yes

yamikaitou commented 6 months ago

This is actually incorrect. The file needs to be saved as we had it but when you interact with the service, you include the instancename.

palmtree5 commented 6 months ago

As stated by @yamikaitou, this is incorrect. What we're doing here is creating a template file that one can then instantiate multiple units off of. To quote from the documentation for systemd.unit

As mentioned above, a unit may be instantiated from a template file. This allows creation of multiple units from a single configuration file. If systemd looks for a unit configuration file, it will first search for the literal unit name in the file system. If that yields no success and the unit name contains an "@" character, systemd will look for a unit template that shares the same name but with the instance string (i.e. the part between the "@" character and the suffix) removed.

So with that, when you attempt to start instancename using systemctl start red@instancename, it is going to find our unit template red@.service and instantiate a service named red@instancename from it.

I am closing this PR as there is no need to change the current instructions on this