Skip to content

Commit 1a92583

Browse files
committed
Check if runner command is valid
1 parent 7650727 commit 1a92583

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

manage-ghar

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,22 @@ start () {
5353

5454
# running as a service, see
5555
# https://docs.github.com/en/actions/hosting-your-own-runners/managing-self-hosted-runners/configuring-the-self-hosted-runner-application-as-a-service
56-
if [[ -z $runner_command ]]
56+
if [[ -z "$runner_command" ]]
5757
then
5858
runner_command="bin/runsvc.sh"
5959
fi
6060

61+
cd "$runner_path"
62+
63+
# check if runner command is valid
64+
if ! ([[ -x "$runner_command" ]] || type "$runner_command" >/dev/null 2>&1)
65+
then
66+
echo "Runner command $runner_command is invalid"
67+
exit 2
68+
fi
69+
6170
echo "Starting runner"
6271
echo "Starting runner on $(hostname)" >>"$state_path/$LOG_FILE"
63-
cd "$runner_path"
6472
$runner_command >>"$state_path/$LOG_FILE" 2>&1 &
6573

6674
# create pid file

0 commit comments

Comments
 (0)