meinside / telegram-bot-systemd

Telegram bot for 'systemctl is-active/start/stop'ing services.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Telegram Bot for Systemd

With this bot, you can systemctl is-active/start/stop services remotely.

0. Prepare

Install Go and generate your Telegram bot's API token.

1. Install

$ go get -d github.com/meinside/telegram-bot-systemd
$ cd $GOPATH/src/github.com/meinside/telegram-bot-systemd
$ cp config.json.sample config.json
$ vi config.json

and edit values to yours:

{
	"api_token": "0123456789:abcdefghijklmnopqrstuvwyz-x-0a1b2c3d4e",
	"available_ids": [
		"your_telegram_id",
		"other_whitelisted_id"
	],
	"controllable_services": [
		"vpnserver",
		"minecraft-server"
	],
	"monitor_interval": 1,
	"is_verbose": false
}

2. Build and run

$ go build

and run it:

$ ./telegram-bot-systemd

3. Run as a service

a. systemd

$ sudo cp systemd/telegram-bot-systemd.service /etc/systemd/system/
$ sudo vi /etc/systemd/system/telegram-bot-systemd.service

and edit User, Group, WorkingDirectory and ExecStart values.

It will launch automatically on boot with:

$ sudo systemctl enable telegram-bot-systemd.service

and will start with:

$ sudo systemctl start telegram-bot-systemd.service

998. Trouble shooting

TODO

999. License

MIT

About

Telegram bot for 'systemctl is-active/start/stop'ing services.


Languages

Language:Go 100.0%