Add systemd service and update capability
This commit is contained in:
parent
a5b5189e52
commit
a8169108b8
3 changed files with 34 additions and 0 deletions
|
@ -78,6 +78,19 @@ async def ping(ctx: lightbulb.Context) -> None:
|
|||
)
|
||||
await ctx.respond(embed)
|
||||
|
||||
@plugin.command
|
||||
@lightbulb.add_checks(lightbulb.owner_only)
|
||||
@lightbulb.command("update", "update the bot!", ephemeral=True)
|
||||
@lightbulb.implements(lightbulb.SlashCommand)
|
||||
async def update(ctx: lightbulb.Context) -> None:
|
||||
if (await get_git_status())['dev'] is False:
|
||||
await create_subprocess("git", "pull")
|
||||
embed = hikari.Embed(title="Restarting",
|
||||
description="Restarting to load an update!"
|
||||
)
|
||||
await ctx.respond(embed)
|
||||
await ctx.bot.close()
|
||||
|
||||
@plugin.command
|
||||
@lightbulb.command("info", "get bot information such as the version, and repository link.", ephemeral=True)
|
||||
@lightbulb.implements(lightbulb.SlashCommand)
|
||||
|
|
6
install
Normal file
6
install
Normal file
|
@ -0,0 +1,6 @@
|
|||
addgroup radical-bot
|
||||
adduser --system --home /otp/radical-bot --ingroup radical-bot radical-bot
|
||||
sudo -u radical-bot git clone https://gitdab.com/InValidFire/radical-bot.git /otp/radical-bot
|
||||
sudo -u radical-bot python3.9 -m pip install -r /otp/radical-bot/requirements.txt
|
||||
cp radical-bot.service /etc/systemd/system
|
||||
systemd enable radical-bot
|
15
radical-bot.service
Normal file
15
radical-bot.service
Normal file
|
@ -0,0 +1,15 @@
|
|||
[Unit]
|
||||
Description=Radical Bot Daemon
|
||||
After=network.target
|
||||
StartLimitIntervalSec=0
|
||||
|
||||
[Service]
|
||||
WorkingDirectory=/otp/radical-bot
|
||||
User=radical-bot
|
||||
Group=radical-bot
|
||||
Restart=always
|
||||
RestartSec=20 3
|
||||
ExecStart=/usr/bin/env python3.9 main.py
|
||||
|
||||
[Install]
|
||||
WantedBy=multi.user.target
|
Loading…
Reference in a new issue