provide and install unit files for service daemons sysvinit/shitstemd
* added a logrotate unit file at standart /etc/logrotate.d/ * shiststemd file unit go to PREFIX/lib/systemd/system/ * systvinit file unit goes to PREFIX/../etc/init.d/ * openrc alpine based unit file goes to /etc/init.d/ but not provided due sysvinit
This commit is contained in:
parent
750adb7504
commit
c811a30507
@ -196,6 +196,9 @@ if(UNIX AND NOT APPLE)
|
|||||||
install(FILES "misc/multicraft-xorg-icon-128.png"
|
install(FILES "misc/multicraft-xorg-icon-128.png"
|
||||||
DESTINATION "${ICONDIR}/hicolor/128x128/apps"
|
DESTINATION "${ICONDIR}/hicolor/128x128/apps"
|
||||||
RENAME "multicraft.png")
|
RENAME "multicraft.png")
|
||||||
|
install(FILES "misc/multicraftserver*service" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system/")
|
||||||
|
install(FILES "misc/multicraftserver*init" DESTINATION "${CMAKE_INSTALL_PREFIX}/../etc/init.d/" RENAME "multicraftserver")
|
||||||
|
install(FILES "misc/multicraft.logrotate" DESTINATION "${CMAKE_INSTALL_PREFIX}/../etc/logrotate.d/" RENAME "multicraftserver")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/var/log/minetest*.log {
|
/var/log/multicraft*.log {
|
||||||
copytruncate
|
copytruncate
|
||||||
notifempty
|
notifempty
|
||||||
missingok
|
missingok
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
#!/bin/sh
|
|
||||||
set -e
|
|
||||||
|
|
||||||
exec @INSTALLPLACE@/multicraftserver \
|
|
||||||
"$@"
|
|
85
misc/multicraftserver.init
Normal file
85
misc/multicraftserver.init
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
#! /bin/sh
|
||||||
|
### BEGIN INIT INFO
|
||||||
|
# Provides: minetest4-server
|
||||||
|
# Required-Start: $remote_fs $network
|
||||||
|
# Required-Stop: $remote_fs $network
|
||||||
|
# Default-Start: 2 3 4 5
|
||||||
|
# Default-Stop: 0 1 6
|
||||||
|
# Short-Description: Start multicraft network game server
|
||||||
|
# Description: dedicated game server for multicraft
|
||||||
|
### END INIT INFO
|
||||||
|
|
||||||
|
PATHBIN="@INSTALLPLACE@"
|
||||||
|
PATHLOG="/var/log/multicraft"
|
||||||
|
PATHETC="/etc/multicraft/muticraft.conf"
|
||||||
|
|
||||||
|
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
|
||||||
|
NAME="multicraftserver"
|
||||||
|
DAEMON="$NAME"
|
||||||
|
DESC="$NAME server"
|
||||||
|
PIDFILE="/var/run/$NAME.pid"
|
||||||
|
BINARY="$PATHBIN/multicraftserver"
|
||||||
|
USER="multicraft"
|
||||||
|
DAEMON_OPTS="--config $PATHETC --logfile $PATHLOG"
|
||||||
|
|
||||||
|
test -x $DAEMON || exit 0
|
||||||
|
|
||||||
|
. /lib/lsb/init-functions
|
||||||
|
|
||||||
|
# Include defaults if available
|
||||||
|
if [ -f /etc/default/$NAME ] ; then
|
||||||
|
. /etc/default/$NAME
|
||||||
|
fi
|
||||||
|
|
||||||
|
multicraft_start() {
|
||||||
|
start-stop-daemon \
|
||||||
|
--start \
|
||||||
|
--quiet \
|
||||||
|
--pidfile $PIDFILE \
|
||||||
|
--oknodo \
|
||||||
|
--background \
|
||||||
|
--exec $BINARY \
|
||||||
|
--startas $DAEMON \
|
||||||
|
--make-pidfile --chuid $USER \
|
||||||
|
-- $DAEMON_OPTS > /dev/null 2>&1 || return 1
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
multicraft_stop() {
|
||||||
|
start-stop-daemon \
|
||||||
|
--stop \
|
||||||
|
--quiet \
|
||||||
|
--pidfile $PIDFILE \
|
||||||
|
--oknodo \
|
||||||
|
--exec $BINARY || return 1
|
||||||
|
rm -f $PIDFILE
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
start)
|
||||||
|
log_begin_msg "Starting $DESC: $NAME"
|
||||||
|
multicraft_start
|
||||||
|
log_end_msg $?
|
||||||
|
;;
|
||||||
|
stop)
|
||||||
|
log_begin_msg "Stopping $DESC: $NAME"
|
||||||
|
multicraft_stop
|
||||||
|
log_end_msg $?
|
||||||
|
;;
|
||||||
|
restart|force-reload)
|
||||||
|
log_begin_msg "Restarting $DESC: $NAME"
|
||||||
|
multicraft_stop && sleep 1 && multicraft_start
|
||||||
|
log_end_msg $?
|
||||||
|
;;
|
||||||
|
status)
|
||||||
|
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
# echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
|
||||||
|
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
exit 0
|
@ -2,13 +2,13 @@
|
|||||||
Description=Multicraft multiplayer server multicraft.conf server config
|
Description=Multicraft multiplayer server multicraft.conf server config
|
||||||
Documentation=man:multicraftserver(6)
|
Documentation=man:multicraftserver(6)
|
||||||
After=network.target
|
After=network.target
|
||||||
RequiresMountsFor=/var/games/multicraftserver
|
RequiresMountsFor=/var/games/multicraft
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=multicraft
|
User=multicraft
|
||||||
Group=games
|
Group=games
|
||||||
ExecStart=/usr/lib/multicraft/multicraftserver --config /etc/multicraft/multicraft.conf --logfile /var/log/multicraft/multicraft.log
|
ExecStart=@INSTALLPLACE@/multicraftserver --config /etc/multicraft/multicraft.conf --logfile /var/log/multicraft/multicraft.log
|
||||||
StandardOutput=null
|
StandardOutput=null
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
@ -2,13 +2,13 @@
|
|||||||
Description=Multicraft multiplayer server %i.conf server config
|
Description=Multicraft multiplayer server %i.conf server config
|
||||||
Documentation=man:multicraftserver(6)
|
Documentation=man:multicraftserver(6)
|
||||||
After=network.target
|
After=network.target
|
||||||
RequiresMountsFor=/var/games/multicraft-server
|
RequiresMountsFor=/var/games/multicraft
|
||||||
|
|
||||||
[Service]
|
[Service]
|
||||||
Restart=on-failure
|
Restart=on-failure
|
||||||
User=multicraft
|
User=multicraft
|
||||||
Group=games
|
Group=games
|
||||||
ExecStart=/usr/lib/multicraft/multicraftserver --config /etc/multicraft/%i.conf --logfile /var/log/multicraft/%i.log
|
ExecStart=@INSTALLPLACE@/multicraftserver --config /etc/multicraft/%i.conf --logfile /var/log/multicraft/%i.log
|
||||||
StandardOutput=null
|
StandardOutput=null
|
||||||
|
|
||||||
[Install]
|
[Install]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user