summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSadie Powell <sadie@witchery.services>2024-03-04 15:27:26 +0000
committerSadie Powell <sadie@witchery.services>2024-04-15 20:29:57 +0100
commit0d149ce1953f7894e69dfa86ca4cc32a70af53ec (patch)
tree03e960110030de1bb58b6ebb67acef06288eb3d5 /src
parentd68ba1b570a0be205dc1c4025fb5d8b4d16f95d5 (diff)
Install a systemd service file on Linux.
Diffstat (limited to 'src')
-rw-r--r--src/tools/CMakeLists.txt8
-rw-r--r--src/tools/anope.service.in17
2 files changed, 25 insertions, 0 deletions
diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt
index 35dcc6139..c029f9177 100644
--- a/src/tools/CMakeLists.txt
+++ b/src/tools/CMakeLists.txt
@@ -29,6 +29,14 @@ endforeach()
# If not on Windows, generate anoperc and install it along with mydbgen
if(NOT WIN32)
+ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+ configure_file(${Anope_SOURCE_DIR}/src/tools/anope.service.in ${Anope_BINARY_DIR}/src/tools/anope.service)
+ install(
+ PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/anope.service
+ DESTINATION ${BIN_DIR}
+ )
+ endif()
+
configure_file(${Anope_SOURCE_DIR}/src/tools/anoperc.in ${Anope_BINARY_DIR}/src/tools/anoperc)
install (PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/anoperc
DESTINATION ${BIN_DIR}
diff --git a/src/tools/anope.service.in b/src/tools/anope.service.in
new file mode 100644
index 000000000..6fe8f652d
--- /dev/null
+++ b/src/tools/anope.service.in
@@ -0,0 +1,17 @@
+[Unit]
+After=network.target
+Description=Anope IRC Services
+Documentation=https://wiki.anope.org/
+After=network-online.target
+Wants=network-online.target
+
+[Service]
+ExecReload=/bin/kill -HUP $MAINPID
+ExecStart=@BIN_DIR@/@PROGRAM_NAME@ --nofork
+Restart=on-failure
+Type=simple
+WorkingDirectory=@CMAKE_INSTALL_PREFIX@
+
+[Install]
+WantedBy=multi-user.target
+