GithubHelp home page GithubHelp logo

yoink's Introduction

Yoink

Setup for Raspberrypi

  1. Transfer repo to your pi. Either use git directly or send it from your local machine via ssh
scp -r yoink/ username@raspberrypi:/home/username/yoink
  1. Install requirements globally. It is important to use sudo for the service to work.
sudo pip3 install -r requirements.txt
  1. Create a .env file in the /yoink folder and store your telegram api key like this
API_KEY='your-api-key'

Setup the service for the script

Now we're going to define the service to run the yoink script:

cd /lib/systemd/system/
sudo vi yoink.service

The service definition must be on the /lib/systemd/system folder. Be sure to switch 'username' for your name.

[Unit]
Description=yoink service
After=multi-user.target

[Service]
WorkingDirectory=/home/username/yoink
Type=simple
ExecStart=/usr/bin/python /home/username/yoink/src/backend/botservice.py
Restart=always

[Install]
WantedBy=multi-user.target

Here we are creating a very simple service that runs the yoink script and if by any means is aborted is going to be restarted automatically. It also starts automatically when the pi restarts. You can check more on service's options in the next wiki: https://wiki.archlinux.org/index.php/systemd.

Now that we have our service we need to activate it:

sudo chmod 644 /lib/systemd/system/yoink.service
chmod +x /home/username/yoink/src/backend/botservice.py
sudo systemctl daemon-reload
sudo systemctl enable yoink.service
sudo systemctl start yoink.service

Service Tasks

For every change that we do on the /lib/systemd/system folder we need to execute a daemon-reload (third line of previous code). If we want to check the status of our service, you can execute:

sudo systemctl status yoink.service

In general:

Check status

sudo systemctl status yoink.service

Start service

sudo systemctl start yoink.service

Stop service

sudo systemctl stop yoink.service

Check service's log

sudo journalctl -f -u yoink.service

Troubleshooting

  • When you use python version < 3.10 the kw_only flags of the dataclasses wont work. Either upgrade the python version or delete all kw_only flags.

References

yoink's People

Contributors

paulmue0 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.