0

I'm using Amazon Linux. I'm running an automated script through Jenkins with this command

Xvfb :10 -ac

However, if this command has already been run before, I get the error ...

(EE) 
Fatal server error:
(EE) Server is already active for display 10
    If this server is no longer running, remove /tmp/.X10-lock
    and start again.
(EE)

How can I modify the above command to only run if there it was not already invoked before with the given variable?

0

As the message says, there is a lock file, /tmp/.X10-lock. So modify your script thusly to only execute if the lock does not exist:

if [[ ! -f /tmp/.X10-lock ]]; then
    Xvfb :10 -ac
else
    echo "INFO: $(date) - X Server already running" 1>&2
fi

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.