mirror of
https://github.com/Syping/dtranslatebot.git
synced 2024-12-22 11:55:30 +01:00
add systemd service file
This commit is contained in:
parent
87961fe611
commit
912ac1eced
3 changed files with 24 additions and 1 deletions
|
@ -77,6 +77,15 @@ if (WIN32)
|
|||
)
|
||||
endif()
|
||||
|
||||
# dtranslatebot systemd Service
|
||||
if (UNIX AND NOT APPLE)
|
||||
option(WITH_SYSTEMD "Build with systemd Support" OFF)
|
||||
if (WITH_SYSTEMD)
|
||||
configure_file(src/systemd/dtranslatebot.service.in "${dtranslatebot_BINARY_DIR}/systemd/dtranslatebot.service" @ONLY)
|
||||
install(FILES "${dtranslatebot_BINARY_DIR}/systemd/dtranslatebot.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# dtranslatebot Target + Installs
|
||||
add_executable(dtranslatebot ${DTRANSLATEBOT_HEADERS} ${DTRANSLATEBOT_SOURCES} ${DTRANSLATEBOT_RESOURCES})
|
||||
target_compile_definitions(dtranslatebot PRIVATE
|
||||
|
|
|
@ -23,4 +23,5 @@ sudo cmake --install dtranslatebot-build
|
|||
```
|
||||
|
||||
##### Optional CMake flags
|
||||
`-DWITH_BOOST=TRUE`
|
||||
`-DWITH_BOOST=TRUE`
|
||||
`-DWITH_SYSTEMD=TRUE`
|
||||
|
|
13
src/systemd/dtranslatebot.service.in
Normal file
13
src/systemd/dtranslatebot.service.in
Normal file
|
@ -0,0 +1,13 @@
|
|||
[Unit]
|
||||
Description=Discord Translation Bot
|
||||
After=network.target
|
||||
|
||||
[Service]
|
||||
User=dtranslatebot
|
||||
Group=dtranslatebot
|
||||
WorkingDirectory="@CMAKE_INSTALL_FULL_RUNSTATEDIR@/dtranslatebot"
|
||||
ExecStart="@CMAKE_INSTALL_FULL_BINDIR@/dtranslatebot" "@CMAKE_INSTALL_FULL_SYSCONFDIR@/dtranslatebot.json"
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
Loading…
Reference in a new issue