Closed stamandster closed 3 months ago
the craftbeerpi.service file is not required as it is being generated from the craftbeerpi.template file. In the past, there used to be a craftbeerpi.service file. However, in this case usesers were only able to run cbpi under user pi. with the template file, you are also able to run cbpi un your case under user chris. From this log I cannot conclude what's really the issue. Did you run cbpi setup from the same path?
Hi @avollkopf sorry for the delay. I'm able to start the server just fine using "cbpi start", and I attempted "cbpi autostart on" and I ran "cbpi setup" from the same locations, /home/chris. This is what I have in my craftbeerbi.template
[Unit] Description=Craftbeer Pi
[Service] WorkingDirectory=/home/chris ExecStart={{ path }} start
[Install] WantedBy=multi-user.target
I was able to solve through testing python script to see if it would do it for me directly and it also failed on using os.getlogin()
import os; print (os.getlogin())
However, through some googling, the following did work for me
import pwd, os; print (pwd.getpwuid(os.getuid()).pw_name)
I edited my cli.py to use that for user query instead of os.getlogin() and was successful in created the service and cbpi is running
config folder path : ./config logs folder path : /home/chris/logs
Debug-log-level is 30
Add craftbeerpi.service to systemd Copied craftbeerpi.service to /etc/systemd/system Created symlink /etc/systemd/system/multi-user.target.wants/craftbeerpi.service → /etc/systemd/system/craftbeerpi.service. Enabled craftbeerpi service Started craftbeerpi.service
Also the documentation at -- https://openbrewing.gitbook.io/craftbeerpi4_support/readme/server-installation It says "craftbeerpi.service" instead of "craftbeerpi.template" to edit.
Thanks for the response. I will look into it and might adapt the code accordingly
Here's some reason why I used this snippet instead of os.getlogin(), I am also logged in remotely. So I have a feeling this is why it wasn't working. If I had do it directly on the RPi it might have worked. But in my situation, it's in the basement headless.
https://stackoverflow.com/questions/47444178/difference-between-os-getlogin-and-os-environ-for-getting-username https://github.com/parmentelat/apssh/issues/1
As you can see from the output below, there is also not a craftbeerpi.service file in my ./config (though there is a .template file), any direction would be appreciated. I did attempt to follow the direction here https://openbrewing.gitbook.io/craftbeerpi4_support/readme/server-installation