Skip to content

Synchronizing Things Automatically

LukeZ edited this page Apr 2, 2025 · 6 revisions

Since we want to be efficient, we use a systemd service which also runs with a timer to do stuff.

If you've already done all this, please continue to the respective wiki page for each service. (Jump down)

Prerequisites

Important

I recommend to do all of this with root-level access to not run into any issues. If you don't do this, you have to execute every command with sudo because we're going to work inside the /etc directory of the server.

Additionally, all of this should be done after the bot is configured and running.

1. Set up your env variables

If you have not already done that, duplicate the local.conf.example in the root directoy (of the bot) and then rename it to local.conf.

ANYTHING BUT local.conf DOESN'T WORK.
If you are an advanced user, you can name it something else BUT it should end in .conf (because of git-tracking) and you will have to edit the .service file later. See the dedicated wiki page for both options as you will need to rename it there.

"Why .conf and not .env?"

An .env file sadly doesn't work with systemd like this but a .conf does.

2. Make the necessary directories and ensure permissions

# Make the directory & Set the owner of the directory to the user the service runs on
mkdir -p /etc/not-supportmail
mkdir -p /etc/systemd/system/not-supportmail
chown -R not-supportmail:not-supportmail /etc/not-supportmail
chown -R not-supportmail:not-supportmail /etc/systemd/system/not-supportmail

# Copy all files from the bot directory into their designated directories on system level
cp /home/<YOUR_USERNAME>/<YOUR_DISCORD_BOT_DIRECTORY>/* /etc/not-supportmail/
# If you are a more advanced user: You only need to copy the package.json, local.conf.example and everything inside /src/cron/

cp /etc/not-supportmail/src/cron/services/* /etc/systemd/system/not-supportmail/
cp /etc/not-supportmail/src/cron/timers/* /etc/systemd/system/not-supportmail/

# Set permissions for important files
chmod 700 /etc/not-supportmail
chmod 600 /etc/not-supportmail/local.conf

Continue

Have followed the steps above? Great! Continue with the things you want to synchronize below.

πŸ‘‰πŸ» Sync Support Posts

πŸ‘‰πŸ» Sync Votes