Use unit file to enable systemd service
Although systemd's systemctl should support an absolute path for unit file commands like for example 'enable', it seems like after latest update of my Fedora 20 environment, the following doesn't work anymore, see: https://bugzilla.redhat.com/show_bug.cgi?id=1174370 Following command fails with absolute path: systemctl enable /usr/lib/systemd/system/mariadb.service But works when replacing absolute path by unit file name only: systemctl enable mariadb.service Change-Id: Icfb7118d641ae7f9326e57817f854d6cd5983246 Closes-Bug: #1402410
This commit is contained in:
@@ -82,9 +82,11 @@ def service_discovery(service_candidates):
|
||||
# replacing a symlink with its real path
|
||||
if os.path.islink(service_path):
|
||||
real_path = os.path.realpath(service_path)
|
||||
result['cmd_enable'] = "sudo systemctl enable %s" % real_path
|
||||
unit_file_name = os.path.basename(real_path)
|
||||
result['cmd_enable'] = ("sudo systemctl enable %s" %
|
||||
unit_file_name)
|
||||
result['cmd_disable'] = ("sudo systemctl disable %s" %
|
||||
real_path)
|
||||
unit_file_name)
|
||||
else:
|
||||
result['cmd_enable'] = "sudo systemctl enable %s" % service
|
||||
result['cmd_disable'] = "sudo systemctl disable %s" % service
|
||||
|
||||
Reference in New Issue
Block a user