How To Install incron on Ubuntu 22.04

In this tutorial we learn how to install incron on Ubuntu 22.04. incron is cron-like daemon which handles filesystem events

Introduction

In this tutorial we learn how to install incron on Ubuntu 22.04.

What is incron

incron is:

incron is an “inotify cron” system. It works like the regular cron but is driven by filesystem events instead of time events. This package provides two programs, a daemon called “incrond” (analogous to crond) and a table manipulator “incrontab” (like “crontab”).

incron uses the Linux Kernel inotify syscalls.

like cron, each user can edit its own incron tables.

incron can be used to :

  • notifying programs (e.g. server daemons) about changes in configuration
  • guarding changes in critical files (with their eventual recovery)
  • file usage monitoring, statistics
  • automatic on-crash cleanup
  • automatic on-change backup or versioning
  • new mail notification (for maildir)
  • server upload notification
  • installation management (outside packaging systems)
  • … and many others

There are three methods to install incron on Ubuntu 22.04. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install incron Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install incron using apt-get by running the following command:

sudo apt-get -y install incron

Install incron Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install incron using apt by running the following command:

sudo apt -y install incron

Install incron Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install incron using aptitude by running the following command:

sudo aptitude -y install incron

How To Uninstall incron on Ubuntu 22.04

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

sudo apt-get remove incron

Uninstall incron And Its Dependencies

To uninstall incron and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:

sudo apt-get -y autoremove incron

Remove incron Configurations and Data

To remove incron configuration and data from Ubuntu 22.04 we can use the following command:

sudo apt-get -y purge incron

Remove incron configuration, data, and all of its dependencies

We can use the following command to remove incron configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge incron

References

Summary

In this tutorial we learn how to install incron package on Ubuntu 22.04 using different package management tools: apt, apt-get and aptitude.