{"id":1046,"date":"2022-12-07T15:50:09","date_gmt":"2022-12-07T15:50:09","guid":{"rendered":"https:\/\/thomas.w-p.me.uk\/blog\/?p=1046"},"modified":"2022-12-28T12:21:51","modified_gmt":"2022-12-28T12:21:51","slug":"python-as-systemctl-service","status":"publish","type":"post","link":"https:\/\/thomas.w-p.me.uk\/blog\/2022\/12\/python-as-systemctl-service\/","title":{"rendered":"python as systemctl service"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Thank you to <a href=\"https:\/\/www.codementor.io\/@ufukafak\/how-to-run-a-python-script-in-linux-with-systemd-1nh2x3hi0e\">codementor.io\/@ufukafak\/how-to-run-a-python-script-in-linux-with-systemd-1nh2x3hi0e<\/a><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">That worked really well. I had to put full path to the settings files in the py script for it to work though. This command works fine.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>sudo systemctl xxxxx teslabot.service<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This means I can retire one of my Rpi for other projects.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Update: I changed the user in the .service file to openhabian so that it would use the ~\/ path successfully forthe config and I would not have to manually change it.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Thank you to codementor.io\/@ufukafak\/how-to-run-a-python-script-in-linux-with-systemd-1nh2x3hi0e That worked really well. I had to put full path to the settings files in the py script for it to work though. This command works fine. This means I can retire one of my Rpi for other projects. Update: I changed the user in the .service file to openhabian so &hellip; <a href=\"https:\/\/thomas.w-p.me.uk\/blog\/2022\/12\/python-as-systemctl-service\/\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">python as systemctl service<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[27,105],"tags":[],"class_list":["post-1046","post","type-post","status-publish","format-standard","hentry","category-geekiness","category-python"],"_links":{"self":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1046","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/comments?post=1046"}],"version-history":[{"count":3,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1046\/revisions"}],"predecessor-version":[{"id":1072,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/posts\/1046\/revisions\/1072"}],"wp:attachment":[{"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/media?parent=1046"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/categories?post=1046"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thomas.w-p.me.uk\/blog\/wp-json\/wp\/v2\/tags?post=1046"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}