2

In this Tips and Tricks article from Red Hat, it is said:

When a service is started through an init script, a file is touched in the /var/lock/subsys/ directory with the same name as the init script. When the service is stopped, this file is removed. The contents of this file are unimportant for the scope of this article, as long as the filename is the same as the init script.

However, some services might require multiple locks. For example, one of the GitLab init scripts requires a lock for unicorn and a lock for sidekiq:

# The PID and LOCK files used by unicorn and sidekiq
UPID=$APP_PATH/tmp/pids/unicorn.pid
ULOCK=/var/lock/subsys/unicorn
SPID=$APP_PATH/tmp/pids/sidekiq.pid
SLOCK=/var/lock/subsys/sidekiq

Would it have been better if the developers had used /var/lock/subsys/gitlab-unicorn and /var/lock/subsys/gitlab-sidekiq? Or perhaps a directory /var/lock/subsys/gitlab/?

Could this problem be avoided by somehow using a single lock file?

What is the best practice for this situation?

Ed I
  • 143
  • 5

0 Answers0