systemd replaces SysV init scripts and some Linux distributions are migrating to or currently support systemd (such as Arch Linux). The traditional start-up script /etc/init.d/splunk (or /etc/rc.d/splunk) does not work in a pure systemd configuration, a unit file is required.
This thread is getting outdated. See the official documentation and additional information below:
- https://docs.splunk.com/Documentation/Splunk/7.2.6/Admin/RunSplunkassystemdservice
- https://docs.splunk.com/Documentation/Splunk/7.2.6/Workloads/Configuresystemd
- https://answers.splunk.com/answers/738877/splunk-systemd-unit-file-in-versions-722-and-newer.html
- https://www.duanewaddle.com/splunk-7-2-2-and-systemd/
finally got around to trying this. worked nice! thx!
Good catch, sspencer. I expect these answers will change over time as systemd evolves.
According to systemd docs, variables cannot be used as the first argument of the ExecStart, ExecStop, and/or ExecReload options. Systemd will not expand those variables. My testing agrees with the documentation. I had to restore the absolute path as shown in the top entry of this answer.
To enable the unit file:
sudo systemctl enable splunkd