How To Install withlock on CentOS 7

In this tutorial we learn how to install withlock on CentOS 7. withlock is Locking wrapper script

Introduction

In this tutorial we learn how to install withlock on CentOS 7.

What is withlock

withlock is a locking wrapper script to make sure that some program isn’t run more than once. It is ideal to prevent periodic jobs spawned by cron from stacking up. The locks created are valid only while the wrapper is running, and thus will never require additional cleanup, even after a reboot. This makes the wrapper safe and easy to use, and much better than implementing half-hearted locking within scripts.

We can use yum or dnf to install withlock on CentOS 7. In this tutorial we discuss both methods but you only need to choose one of method to install withlock.

Install withlock on CentOS 7 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install withlock using yum by running the following command:

sudo yum -y install withlock

Install withlock on CentOS 7 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install withlock using dnf by running the following command:

sudo dnf -y install withlock

How To Uninstall withlock on CentOS 7

To uninstall only the withlock package we can use the following command:

sudo dnf remove withlock

References

Summary

In this tutorial we learn how to install withlock on CentOS 7 using yum and dnf.