start-agent.sh 646 Bytes
Newer Older
1
#!/bin/sh
2

3
# agent.jar has to be downloaded from http://localhost/jnlpJars/agent.jar
4

5
# There doesn't seem to be any better way to figure out the agent name
6 7 8
# from here, let's just hope all WORKSPACE have been set correctly
NODE_NAME="$(basename ${WORKSPACE})"

9
echo "Starting agent.jar for ${NODE_NAME}..."
10 11 12 13

f="/var/lib/jenkins/offline_nodes"
if [ -f "$f" ]; then
    if grep -q "$NODE_NAME" "$f"; then
14
        echo "This node is currently marked as offline, not starting agent.jar"
15 16 17 18
        exit 1
    fi
fi

19
echo "This jenkins agent.jar will run as PID $$."
Holger Levsen's avatar
Holger Levsen committed
20
export JAVA_ARGS="-Xms1G -Xmx2G"
21
exec java $JAVA_ARGS -jar /var/lib/jenkins/agent.jar