Last active
October 17, 2022 18:21
-
-
Save TehPeGaSuS/177325c0cb14564bc45a7ba1885d9862 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#--------------------------------------------------# | |
# Be sure to have screen installed in your machine # | |
# Systemd unit tested on Ubuntu 18.04 and newer # | |
#--------------------------------------------------# | |
#----------------------------------------------------------------------------# | |
# This script will start the bot under a dettached screen session so you can # | |
# attach to the session and use the terminal to simulate DCC chat # | |
# You can still use telnet to connect to the bot, nonetheless # | |
#----------------------------------------------------------------------------# | |
[Unit] | |
#------------------------------------------------------------------# | |
# Set here the description to be shown on systemd control commands # | |
## # | |
# Example: Description=Micaela (Eggdrop) # | |
#------------------------------------------------------------------# | |
Description=Micaela (Eggdrop) | |
#-------------------------------------------------------------# | |
# DO NOT EDIT THIS OPTION UNLESS YOU KNOW WHAT YOUR'RE DOING! # | |
#-------------------------------------------------------------# | |
After=default.target | |
[Service] | |
#----------------------------------------------# | |
# Path to your bot folder # | |
## # | |
# Example: WorkingDirectory=/home/bots/Micaela # | |
#----------------------------------------------# | |
WorkingDirectory=/home/bots/Micaela | |
#------------------------------------------------------------------------------------------------------------------------------------# | |
# Command to start the bot, using a screen session. # | |
## # | |
# Example: ExecStart=/usr/bin/screen -L -U -dmS Micaela /home/bots/Micaela/eggdrop -t micaela.conf # | |
# Explanation of the options used here: # | |
# -L = logs the entire screen session on a file named screenlog.0 in the bot folder. # | |
# -U = Tell screen to use UTF-8 encoding. # | |
# -dmS <name> = Start as daemon: Screen session in detached mode. # | |
#------------------------------------------------------------------------------------------------------------------------------------# | |
ExecStart=/usr/bin/screen -L -U -dmS Micaela /home/bots/Micaela/eggdrop -t micaela.conf | |
#---------------------------------------------------------------------------------------------------# | |
# Command to stop the bot # | |
## # | |
# Unfortunatelly seems I have to send a `quit` to the screen session, otherwise it will error with: # | |
# Main process exited, code=exited, status=1/FAILURE # | |
## # | |
# Example: ExecStop=/usr/bin/screen -XS Micaela quit # | |
#---------------------------------------------------------------------------------------------------# | |
ExecStop=/usr/bin/screen -XS Micaela quit | |
#---------------------------------------------------------------------------------------------------------------# | |
# DON'T TOUCH ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING! # | |
# # | |
# If you touch the code below and then complain the script "suddenly stopped working", I'll touch you at night. # | |
#---------------------------------------------------------------------------------------------------------------# | |
Type=forking | |
Restart=on-failure | |
[Install] | |
WantedBy=default.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Examples
Actual valid user unit for example purposes:
Example output of
systemctl --user status botname_screen_user.service
:After this, you can use
telnet
to login to the bot or just usescreen -r Scheherazade
. To detach from a screen session, useCtrl+A, D