-
-
Notifications
You must be signed in to change notification settings - Fork 812
Using with systemctl
Aahnik Daw edited this page Jun 25, 2021
·
2 revisions
For more info about running tgcf in the background read this discussion ➥
Step by step guide
Step 1.
Create an executable shell script to start tgcf from the proper folder. Let's name it tgcf_start.sh
and put it in your home folder.
#!/usr/bin/bash
cd /home/aahnik/Desktop/tgcf # the folder in which tgcf is cloned
# dont use ~ in the path, use full expanded absolute path
# the folder must contain the proper .env and tgcf.config.yml files
# tgcf must be installed inside a virtual env (recommended)
# install tgcf using pip or clone the repo and run poetry install
.venv/bin/tgcf live --loud
Make the script executable.
chmod +x tgcf_start.sh
Step 2. Create a service.
Create a file named tgcf.service
and put the following content into it.
[Unit]
Description=The ultimate tool to automate custom telegram message forwarding.
After=network.target
[Install]
WantedBy=multi-user.target
[Service]
Type=simple
ExecStart=/home/aahnik/tgcf_start.sh
# use the absolute path of the shell script in your server
Restart=always
RestartSec=5
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=%n
Step 3. Install and enable the service.
sudo mv tgcf.service /etc/systemd/system
sudo systemctl daemon-reload
sudo systemctl enable tgcf.service
Now to start tgcf using systemctl you can simply do
sudo systemctl start tgcf
You can also see the status of the service by running
sudo systemctl status tgcf
To see the live logs
journalctl -f -u tgcf
To stop the service
sudo systemctl stop tgcf
Have a question? Ask in the discussion forum. But make sure to read the wiki first.