@ -490,7 +490,7 @@ class LinuxService(Service):
self . upstart_version = LooseVersion ( ' 0.0.0 ' )
self . upstart_version = LooseVersion ( ' 0.0.0 ' )
try :
try :
version_re = re . compile ( r ' \ (upstart (.*) \ ) ' )
version_re = re . compile ( r ' \ (upstart (.*) \ ) ' )
rc , stdout , stderr = self . module . run_command ( ' initctl version' )
rc , stdout , stderr = self . module . run_command ( ' %s version' % location [ ' initctl ' ] )
if rc == 0 :
if rc == 0 :
res = version_re . search ( stdout )
res = version_re . search ( stdout )
if res :
if res :
@ -498,9 +498,7 @@ class LinuxService(Service):
except :
except :
pass # we'll use the default of 0.0.0
pass # we'll use the default of 0.0.0
if location . get ( ' start ' , False ) :
self . svc_cmd = location [ ' initctl ' ]
# upstart -- rather than being managed by one command, start/stop/restart are actual commands
self . svc_cmd = ' '
elif location . get ( ' rc-service ' , False ) :
elif location . get ( ' rc-service ' , False ) :
# service is managed by OpenRC
# service is managed by OpenRC
@ -922,8 +920,13 @@ class LinuxService(Service):
arguments = self . arguments
arguments = self . arguments
if self . svc_cmd :
if self . svc_cmd :
if not self . svc_cmd . endswith ( " systemctl " ) :
if not self . svc_cmd . endswith ( " systemctl " ) :
# SysV and OpenRC take the form <cmd> <name> <action>
if self . svc_cmd . endswith ( " initctl " ) :
svc_cmd = " %s %s " % ( self . svc_cmd , self . name )
# initctl commands take the form <cmd> <action> <name>
svc_cmd = self . svc_cmd
arguments = " %s %s " % ( self . name , arguments )
else :
# SysV and OpenRC take the form <cmd> <name> <action>
svc_cmd = " %s %s " % ( self . svc_cmd , self . name )
else :
else :
# systemd commands take the form <cmd> <action> <name>
# systemd commands take the form <cmd> <action> <name>
svc_cmd = self . svc_cmd
svc_cmd = self . svc_cmd