0

I am trying to setup Jenkins Slave on mac mini. Have created /Library/LaunchDaemons/com.jenkins.ci.plist with following contents

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>Label</key>
    <string>com.jenkins.ci</string>
        <key>UserName</key>
        <string>jenkins</string>
        <key>SessionCreate</key>
        <true/>
    <key>ProgramArguments</key>
    <array>
      <string>/usr/bin/java</string>
          <string>-Djava.awt.headless=true</string>
      <string>-jar</string>
      <string>/Users/jenkins/agent.jar</string>
          <string>-jnlpUrl</string>
          <string>http://jenkins.example.com:8080/computer/jenkins2-slave3/slave-agent.jnlp</string>
          <string>-secret</string>
          <string>****************************</string>
          <string>-workDir</string>
          <string>"/Users/jenkins/jenkins_slave/"</string>
    </array>
    <key>RunAtLoad</key>
    <true/>
        <key>KeepAlive</key>
        <true/>
    <key>StandardErrorPath</key>
    <string>/Users/jenkins/error.log</string>
    <key>StandardOutPath</key>
    <string>/Users/jenkins/stdout.log</string>
</dict>
</plist>

But when I reboot mac mini, jenkins agent doesn't start automatically. Every time i have to run manual command in the terminal.

jenkins2-slave3:~ jenkins$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

What I am missing here ?

3
  • 2
    At first glance, the quotes around /Users/jenkins/jenkins_slave/ look strange (and are not necessary and most likely harmful). Also, is there anything useful in the logs?
    – nohillside
    May 11, 2022 at 15:14
  • How have you installed java? Also note that environment variables set in shells will not be read from launchd
    – mmmmmm
    May 11, 2022 at 16:25
  • Have you got permissions correct on the file? And is it in the right place?
    – Mr R
    May 11, 2022 at 20:29

1 Answer 1

2

Removing double quotes from this like help to fix the issue.

          <string>/Users/jenkins/jenkins_slave/</string>

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .