From 2d97cef1d27576cc043246b5c136e304e7a73f00 Mon Sep 17 00:00:00 2001 From: Bryan MacFarlane Date: Wed, 15 Apr 2020 14:25:11 -0400 Subject: [PATCH] sudo svc on linux --- scripts/create-latest-svc.sh | 9 +++++++-- scripts/remove-svc.sh | 4 ++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/scripts/create-latest-svc.sh b/scripts/create-latest-svc.sh index 17da08bff..1971fda8a 100755 --- a/scripts/create-latest-svc.sh +++ b/scripts/create-latest-svc.sh @@ -126,5 +126,10 @@ sudo -E -u ${svc_user} ./config.sh --unattended --url $runner_url --token $RUNNE #--------------------------------------- echo echo "Configuring as a service ..." -./svc.sh install ${svc_user} -./svc.sh start +prefix="" +if [ "${runner_plat}" == "linux" ]; then + prefix="sudo " +fi + +${prefix}./svc.sh install ${svc_user} +${prefix}./svc.sh start diff --git a/scripts/remove-svc.sh b/scripts/remove-svc.sh index e588d6904..1c95bfb52 100755 --- a/scripts/remove-svc.sh +++ b/scripts/remove-svc.sh @@ -62,6 +62,6 @@ echo $REMOVE_TOKEN echo echo "Uninstall the service ..." pushd ./runner -./svc.sh stop -./svc.sh uninstall +${prefix}./svc.sh stop +${prefix}./svc.sh uninstall ./config.sh remove --token $REMOVE_TOKEN