aboutsummaryrefslogtreecommitdiff
path: root/systemd-service-create.py
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-20 14:14:47 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-20 14:14:47 +0300
commitff4d525347aa73b52851a78bf3b5933c59f8833f (patch)
treed618cdc40ea395e67fb7a4bfbb510ac225f2bae8 /systemd-service-create.py
parent723cce0f413ff3984b8605e56090987a67834b5c (diff)
downloadRepoSync-ff4d525347aa73b52851a78bf3b5933c59f8833f.tar
RepoSync-ff4d525347aa73b52851a78bf3b5933c59f8833f.tar.gz
RepoSync-ff4d525347aa73b52851a78bf3b5933c59f8833f.zip
Improved some spacing and improved SELinux warning
Diffstat (limited to 'systemd-service-create.py')
-rwxr-xr-xsystemd-service-create.py13
1 files changed, 4 insertions, 9 deletions
diff --git a/systemd-service-create.py b/systemd-service-create.py
index 4527bd4..bec73e1 100755
--- a/systemd-service-create.py
+++ b/systemd-service-create.py
@@ -11,9 +11,7 @@ except PermissionError as e:
exit("You must run this script as root!")
cwd = os.getcwd()
-
-if "home" in cwd:
- print("Warning: you are running this script from the home directory! If you use SELinux, the service won't work (https://serverfault.com/a/957087/592409)!")
+print("WARNING: if you use SELinux, you'll need to move the whole repository into /usr/local/share/ or copy reposync.py and update the repository list file location (https://serverfault.com/a/957087/592409)!")
service_file = open(r"/etc/systemd/system/reposync.service", "w")
service_file.write(
@@ -23,8 +21,7 @@ Description=Python script for synchronizing repositories
[Service]
Type=oneshot
WorkingDirectory={cwd}
-ExecStart={cwd}/reposync.py
-""")
+ExecStart={cwd}/reposync.py""")
service_file.close()
timer_file = open(r"/etc/systemd/system/reposync.timer", "w")
@@ -37,12 +34,10 @@ OnBootSec=10min
OnUnitActiveSec=10min
[Install]
-WantedBy=timers.target
-""")
+WantedBy=timers.target""")
timer_file.close()
print(
"""reposync.service and reposync.timer files created successfully!
You'll now need to run the following to activate them (as root): systemctl daemon-reload && systemctl start reposync.timer
-To remove them, execute (as root) this: rm -f /etc/systemd/system/reposync.*
-""")
+To remove them, execute (as root) this: rm -f /etc/systemd/system/reposync.*""")