added systemd services

This commit is contained in:
celso 2024-12-18 10:51:48 -03:00
parent 06c5061479
commit b2765dc3fa
9 changed files with 222 additions and 0 deletions

View File

@ -0,0 +1,21 @@
[Unit]
Description=dedicated counter-strike 1.6 server
Wants=network.target
PartOf=steam-tmux-master.service
After=steam-tmux-master.service
[Service]
Type=oneshot
WorkingDirectory=/home/steam/counter-strike1.6
User=steam
Group=steam
Environment=STEAMOS=1
Environment=STEAM_RUNTIME=1
Environment="DBUS_FATAL_WARNINGS=0"
Environment="ADMIN=STEAM_[REDACTED]"
RemainAfterExit=yes
ExecStart=/usr/bin/tmux new-session -s cstrike -d /home/steam/counter-strike1.6/start-server.sh
ExecStop=/usr/bin/tmux send-keys -t cstrike "/quit" Enter
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,17 @@
[Unit]
Description=telegram disk monitoring bot
Wants=network.target
[Service]
Type=forking
WorkingDirectory=/home/diskconnectbot/diskconnectbot
User=diskconnectbot
Group=diskconnectbot
RemainAfterExit=yes
Environment="TELEGRAM_DSK_TOKEN=[REDACTED]"
ExecStart=/usr/bin/tmux new-session -s diskconnectbot -d /home/diskconnectbot/diskconnectbot/bot.sh start
ExecStop=/usr/bin/tmux kill-session -t diskconnectbot
KillMode=none
[Install]
WantedBy=multi-user.target

17
systemd/factorio.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=factorio game server
Wants=network.target
PartOf=steam-tmux-master.service
After=steam-tmux-master.service
[Service]
Type=oneshot
WorkingDirectory=/home/steam/factorio
User=steam
Group=steam
RemainAfterExit=yes
ExecStart=/usr/bin/tmux new-session -s factorio -d /home/steam/factorio/start-server.sh
ExecStop=/usr/bin/tmux send-keys -t factorio "/quit" Enter
[Install]
WantedBy=multi-user.target

87
systemd/gitea.service Normal file
View File

@ -0,0 +1,87 @@
[Unit]
Description=Gitea (Git with a cup of tea)
After=syslog.target
After=network.target
###
# Don't forget to add the database service dependencies
###
#
#Wants=mysql.service
#After=mysql.service
Wants=mariadb.service
After=mariadb.service
#Wants=postgresql.service
#After=postgresql.service
#Wants=memcached.service
#After=memcached.service
Wants=redis.service
After=redis.service
#
###
# If using socket activation for main http/s
###
#
#After=gitea.main.socket
#Requires=gitea.main.socket
#
###
# (You can also provide gitea an http fallback and/or ssh socket too)
#
# An example of /etc/systemd/system/gitea.main.socket
###
##
## [Unit]
## Description=Gitea Web Socket
## PartOf=gitea.service
##
## [Socket]
## Service=gitea.service
## ListenStream=<some_port>
## NoDelay=true
##
## [Install]
## WantedBy=sockets.target
##
###
[Service]
# Uncomment the next line if you have repos with lots of files and get a HTTP 500 error because of that
# LimitNOFILE=524288:524288
RestartSec=2s
Type=notify
User=git
Group=git
WorkingDirectory=/var/lib/gitea/
# If using Unix socket: tells systemd to create the /run/gitea folder, which will contain the gitea.sock file
# (manually creating /run/gitea doesn't work, because it would not persist across reboots)
#RuntimeDirectory=gitea
ExecStart=/usr/local/bin/gitea web --config /etc/gitea/app.ini -p 3002
Restart=always
Environment=USER=git HOME=/home/git GITEA_WORK_DIR=/var/lib/gitea
WatchdogSec=30s
# If you install Git to directory prefix other than default PATH (which happens
# for example if you install other versions of Git side-to-side with
# distribution version), uncomment below line and add that prefix to PATH
# Don't forget to place git-lfs binary on the PATH below if you want to enable
# Git LFS support
#Environment=PATH=/path/to/git/bin:/bin:/sbin:/usr/bin:/usr/sbin
# If you want to bind Gitea to a port below 1024, uncomment
# the two values below, or use socket activation to pass Gitea its ports as above
###
#CapabilityBoundingSet=CAP_NET_BIND_SERVICE
#AmbientCapabilities=CAP_NET_BIND_SERVICE
###
# In some cases, when using CapabilityBoundingSet and AmbientCapabilities option, you may want to
# set the following value to false to allow capabilities to be applied on gitea process. The following
# value if set to true sandboxes gitea service and prevent any processes from running with privileges
# in the host user namespace.
###
#PrivateUsers=false
###
[Install]
WantedBy=multi-user.target

17
systemd/openttd.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=openttd game server
Wants=network.target
PartOf=steam-tmux-master.service
After=steam-tmux-master.service
[Service]
Type=oneshot
WorkingDirectory=/home/steam
User=steam
Group=steam
RemainAfterExit=yes
ExecStart=/usr/bin/tmux new-session -s openttd -d "/usr/local/games/openttd -D 192.168.1.11:3979 -c /home/steam/.config/openttd/openttd.cfg -g /home/steam/.local/share/openttd/save/save.sav"
ExecStop=/usr/bin/tmux send-keys -t openttd "quit" Enter
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,13 @@
[Unit]
Description=tmux master service for the steam user
[Service]
Type=forking
User=steam
Group=steam
ExecStart=/usr/bin/tmux start-server \; set -g exit-empty off
ExecStop=/usr/bin/tmux kill-server
[Install]
WantedBy=multi-user.target

16
systemd/syncplay.service Normal file
View File

@ -0,0 +1,16 @@
[Unit]
Description=syncplay server
Wants=network.target
[Service]
Type=forking
WorkingDirectory=/srv/syncplay
User=syncplay
Group=syncplay
RemainAfterExit=yes
ExecStart=/usr/bin/tmux new-session -s syncplay -d /srv/syncplay/autorun.sh
ExecStop=/usr/bin/tmux kill-server
KillMode=none
[Install]
WantedBy=multi-user.target

17
systemd/terraria.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=terraria game server
Wants=network.target
PartOf=steam-tmux-master.service
After=steam-tmux-master.service
[Service]
Type=oneshot
WorkingDirectory=/home/steam/terraria
User=steam
Group=steam
RemainAfterExit=yes
ExecStart=/usr/bin/tmux new-session -s terraria -d "/home/steam/terraria/start-server.sh"
ExecStop=/usr/bin/tmux send-keys -t terraria "/exit" Enter
[Install]
WantedBy=multi-user.target

17
systemd/tpdnsbot.service Normal file
View File

@ -0,0 +1,17 @@
[Unit]
Description=telegram personal DNS bot
Wants=network.target
[Service]
Type=forking
WorkingDirectory=/home/tpdnsbot/tpdnsbot
User=tpdnsbot
Group=tpdnsbot
RemainAfterExit=yes
Environment="TELEGRAM_DNS_TOKEN=[REDACTED]"
ExecStart=/usr/bin/tmux new-session -s tpdnsbot -d /home/tpdnsbot/tpdnsbot/bot.sh start
ExecStop=/usr/bin/tmux kill-session -t tpdnsbot
KillMode=none
[Install]
WantedBy=multi-user.target