0

I'm new to VPS and I want to run a Python script forever. I followed instructions in this post but I'm missing something because it's not working

I made my botWooService.service file in /etc/systemd/system/. This is what it contains

[Unit]
Description=botWoo
After=syslog.target network.target

[Service]
Type=simple
User=root
WorkingDirectory=home/bots/botWoo/venv
ExecStart=home/bots/botWoo/venv/bin/python home/bots/botWoo/main.py --serve-in-foreground
Restart=on-abort

[Install]
WantedBy=multi-user.target

When I run systemctl start botWooService I get:

Failed to start botWooService.service: Unit is not loaded properly: Invalid argument.
See system logs and 'systemctl status botWooService.service' for details.

I am not sure if it's not working properly because I am using Environment Variables and there is a .env file in home/bots/botWoo/ or if the issue is due to something else.

When I run home/bots/botWoo/venv/bin/python -m site this is the output

sys.path = [
'/',
'/usr/lib64/python36.zip',
'/usr/lib64/python3.6',
'/usr/lib64/python3.6/lib-dynload',
'/home/bots/botWoo/venv/lib64/python3.6/site-packages',
'/home/bots/botWoo/venv/lib/python3.6/site-packages',
]
USER_BASE: '/root/.local' (exists)
USER_SITE: '/root/.local/lib/python3.6/site-packages' (doesn't exist)
ENABLE_USER_SITE: False

And when I run python -m site I get this:

sys.path = [
'/',
'/usr/lib64/python27.zip',
'/usr/lib64/python2.7',
'/usr/lib64/python2.7/plat-linux2',
'/usr/lib64/python2.7/lib-tk',
'/usr/lib64/python2.7/lib-old',
'/usr/lib64/python2.7/lib-dynload',
'/usr/lib64/python2.7/site-packages',
'/usr/lib64/python2.7/site-packages/gtk-2.0',
'/usr/lib/python2.7/site-packages',
]
USER_BASE: '/root/.local' (exists)
USER_SITE: '/root/.local/lib/python2.7/site-packages' (doesn't exist)
ENABLE_USER_SITE: True

So I am not getting the same output and I really don't know what this means. Hopefully someone can point me in the right direction. Thank you.

  • 1
    The error you posted here is very light on details. You need to dig a little deeper to find the actual problem. As the error says: "See system logs and 'systemctl status botWooService.service' for details." Look at the log to see what the full error message is. Hopefully you can figure out which argument is invalid. – Code-Apprentice Jul 20 '22 at 04:40
  • 1
    As a suggestion to try, I think `home...` should be `/home...`. – Code-Apprentice Jul 20 '22 at 04:40
  • @Code-Apprentice that actually helped, I just changed it and didn't get any error when executing 'systemctl start botWooService'. Now I just need to see if it's actually running. – Erick Navarro Jul 20 '22 at 05:00
  • @Code-Apprentice yep. now it's running. omg Thank you very much, I really appreciate it. The only issue was the missing / – Erick Navarro Jul 20 '22 at 05:09
  • For your future reference, I suggest you learn more about paths. Specifically the difference between absolute and relative paths. And you can also familiarize yourself with the (somewhat) standard directory structure used in Linux. – Code-Apprentice Jul 20 '22 at 14:46

0 Answers0