There are a number of ways to have a script run on boot or startup, noting that it's a server.
If by chance the server is running a desktop or window manager, there may be a configuration in that software to add an executable script. For example, to pick one window manager such as icewm, in order to start some programs when icewm starts up, one can use a file ~/.icewm/startup within which there's a reference to the relevant script. The large DEs, gnome and KDE both have such configuration availabilities.
Just saw
@CaffeineAddict provide some details in post #2 for KDE!
Another means, in a systemd system, independent of GUI apps, is to write a systemd script. For example, a format like the following in a systemd service file named <some-evocative-name>.service, with the following contents all properly specified to give effect to the script:
Code:
[Unit]
Description=<a_description_of_the_the_script's_function>
[Service]
Type=oneshot
ExecStart=/bin/sh -c <path_to_the_script>
[Install]
WantedBy=multi-user.target
When the file is written it can be placed in /etc/systemd/system, or some other relevant directory, enabled and it will run.
Another means, in a systemd system, is to use the /etc/rc.local file. The file needs to be created, given executable permissions, and have a reference to the script for its contents. Systemd will then run it at the end of the boot without any more ado.
If the machine is running a sysVinit system, then one needs to write a configuration file written into the appropriate runlevel in /etc, for example, in /etc/rc.3 for runlevel 3, or however the sysVinit is organised. The configuration of such a file has a specific format which needs to be adhered to which is quite a bit more involved than simply referring to the script as in the /etc/rc.local described above. Since most distros still include such files in /etc/init.d or thereabouts, one can inspect them to see how they are written. A sysVinit system may also honour the /etc/rc.local method, which can be simpler.
There are possible issues with starting scripts at boot which depend on what the scripts are doing. If, for example, a script needs to use a network, then that network has to be running by the time the script is called after boot. There are configuration options in the systemd unit files to get these matters happen in an orderly way. With the /etc/rc.local file however, such an issue would need care since a script that needs the network may fail if the network takes longer to get up than the time it takes the boot to run the script.