deploy as a systemd service.
mwoolweaver opened this issue · comments
I have managed to get this running as a system service. Has been running consistently for over a week and can be seen on twitter @ https://twitter.com/ComputeHole.
what is needed to get this running as a system service on Ubuntu 19.04 (should be the same for any Linux system using systemd
Step 1.)
clone the GitHub repo
git clone https://github.com/BrianMitchL/weatherBot.git
Step 2.)
edit keys.py
in your favorite text editor and fill in the required information
Step 3.)
create the following file
sudo nano /etc/systemd/system/weatherBot.service
with the following content
[Unit]
Description=weatherBot
[Service]
Type=simple
WorkingDirectory=/path/to/weatherBot/GitHub/clone
ExecStart=/usr/bin/python3 weatherBot.py weatherBot.conf
[Install]
WantedBy=multi-user.target
Step 4.)
after creating the file above run the following commands
sudo systemctl enable weatherBot.service
Your weatherBot will now run as a systemd service
and start @ boot
sudo systemctl start weatherBot.service
Your weatherBot is now running as a systemd service
" weatherBot.service
"
you can check the status by running
sudo systemctl status weatherBot.service
if changes are made the configuration of weatherBot you will have to reload the service for changes to be noticed
sudo systemctl daemon-reload
Step 5.)
????
Step 6.)
Profit.
I would have created a P/R but I wasn't sure how to go about adding the information correctly.
Also one benefit of this is it doesn't require the installation of any additional software to make use of this great project!!
This is great, thanks! I'll add some docs in the next few days.
might I suggest adding the different way to deploy weatherBot as separate Wiki pages? And then link to them in the README.md so it doesn't overly long?
Good suggestion, thanks! I moved the existing examples over and will work on adapting the systemd example you have above tomorrow.
No problem. Thanks for this project! Also let me know if you need anymore information and I'll do my best to provide it.
I added a systemd page to the wiki based off your example: https://github.com/BrianMitchL/weatherBot/wiki/Deploy---systemd Feel free to open a new issue or comment here if you think anything needs changing!
also from my experience this is true but it also extends to the actual weatherBot configuration files to, i.e. say you change the #hashtag that's tweeted, you'll have to do a daemon-reload or reboot the system
If changes are made to the weatherBot.service file, you will need to reload the service for changes to take effect.
systemd doesn't care about files that are passed read by weatherBot, so restarting weatherBot (stopping and starting the service) would be enough. I haven't tested in a while thought, so I could totally be wrong.