Skip to content
This repository was archived by the owner on Mar 26, 2022. It is now read-only.

Commit c7c4edd

Browse files
committed
Restart caching service when using --configureserver
Signed-off-by: Erik Gomez <e@eriknicolasgomez.com>
1 parent 58ecb90 commit c7c4edd

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎cacher.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,19 @@ def configureserver():
663663
return None
664664

665665

666+
def serveradmin(action, service):
667+
try:
668+
cmd = [
669+
'/Applications/Server.app/Contents/ServerRoot/usr/sbin/server'
670+
'admin', action, service]
671+
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
672+
stderr=subprocess.PIPE)
673+
output, err = proc.communicate()
674+
return output.rstrip()
675+
except Exception:
676+
return None
677+
678+
666679
def post_to_slack(targetDate, cacherdata, slackchannel, slackusername,
667680
slackwebhook):
668681
# Server App Icon DL
@@ -750,6 +763,9 @@ def main():
750763
sys.exit(1)
751764
else:
752765
print 'Caching Server settings are now: ' + configureserver()
766+
print '\nRestarting Caching Service...'
767+
print '\n' + serveradmin('stop', 'caching')
768+
print '\n' + serveradmin('start', 'caching')
753769
sys.exit(1)
754770

755771
# Check if LogClientIdentity is configured correctly. If it isn't - bail.

0 commit comments

Comments
 (0)