Sponsored Content
Operating Systems Linux [TIP] incrond - the cron for filesystem activities Post 303045614 by the-architect on Friday 3rd of April 2020 12:12:41 PM
Old 04-03-2020
[TIP] incrond - the cron for filesystem activities

Hi,

just want to note there's a cron-like daemon that allows to initiate actions not based on time but on filesystem activities. (File created, accessed, written to, moved, deleted, ...)

It's called incron because of it's inotify based nature. It's available at least for linux in the distribution repositories for quite some time now.

See the github page for some simple examples. (Search google for github and incron to get to the incron repository)

greetz,
architect
This User Gave Thanks to the-architect For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Keeping an eye on all user activities

I am responsible for administering 6 Tru64UX servers. I need to keep an eye on all the commands executed by all the users. Is there a way where I can save the commands executed in a seperate folder and then keep checking the list every now and then. How can do it ? (5 Replies)
Discussion started by: shauche
5 Replies

2. UNIX for Advanced & Expert Users

Tracking activities of Users using a particular login.

Hi!! Experts, I have a typical scenario here in which several users have access to a particular login .. say "build". None of the users know the passwd for this login. The name of some of the user have been to .rhosts file. The users can connect only by doing a rlogin to this id and then... (4 Replies)
Discussion started by: jyotipg
4 Replies

3. Shell Programming and Scripting

patterns from logs and activities

hi, i need help writing shell scripts to define patterns of user activities on our apache. i thought about going through logfiles and other places where user activities are stored and use that data to define patterns of action. i want these patterns to be visualized then. now my... (3 Replies)
Discussion started by: rocketkids
3 Replies

4. Shell Programming and Scripting

Need for loop to do 2 activities

I need my for loop to do 2 things at a time. I have a script where I move the old files into archive directory and then i want to compress them. Presently I am using 2 for loops for it. How can i do it in 1 for loop. Code: after this i am compresing them in another for loop: (3 Replies)
Discussion started by: dsravan
3 Replies

5. Solaris

SYSLOGS - Where can I find FTP activities

Greetings to all. I need help from the experts. I have been given a FTP server script that runs all day, looking for files that are FTP'd to our machines. Its hoaky I know, but there are times that files are sent but somehow get lost. Is there a logfile I can view to see when files are received? ... (1 Reply)
Discussion started by: Harleyrci
1 Replies

6. UNIX for Advanced & Expert Users

[Tip] How to add an application cron job?

A well established form of application cron jobs look like this: 39 15 * * * && /usr/local/monitoring/oracle/check_dbs.sh >/dev/null 2>&1The repetition makes it a long line, hard to read, hard to maintain. I suggest the following instead: 39 15 * * * { /usr/local/monitoring/oracle/check_dbs.sh... (1 Reply)
Discussion started by: MadeInGermany
1 Replies

7. UNIX for Advanced & Expert Users

[Tip] How to add individual delays to a cron job?

ofIn a big Unix environment you likely install cron jobs like this on a thousand systems: 39 15 * * * { /usr/local/monitoring/sendstats ; } >/dev/null 2>&1If all the system clocks are synchronized (usually via NTP), these jobs run *exactly* at the same time. If the cron job accesses a shared... (2 Replies)
Discussion started by: MadeInGermany
2 Replies

8. UNIX for Advanced & Expert Users

Issue with IN_CLOSE_WRITE Event Of incrond

Hello All, I have below file system IN_CLOSE_WRITE event defined in my incrontab file, however it looks like the events kick off earlier even before the file transmission is complete and kicks off the shell script with partial file (file.xml.filepart) and causing issues. Is there any way i can... (4 Replies)
Discussion started by: Ariean
4 Replies

9. SuSE

How do I make activities appear in SYSLOG file?

SUSE Linux 11 and 10 SP3. I am trying to capture some of my activities in SYSLOG file, /var/log/messages. To do this I created and dropped some test files and directories and users. But these activities are not captured in /var/log/messages. What should I do to make these activities... (7 Replies)
Discussion started by: JDBA
7 Replies

10. UNIX for Advanced & Expert Users

Tip: inotify cron

Dear members, moderators and others. While working on <insert project>, a need has surfaced to watch a directory, and when a file comes, to do appropriate action. So, i started writing some shell code, aware of linux inotify-tools package with inotifywait. Also, i'm seeing a lot of similar... (1 Reply)
Discussion started by: Peasant
1 Replies
incrond(8)						       incron documentation							incrond(8)

NAME
incrond - inotify cron (incron) daemon SYNOPSIS
incrond [ -f file ] [ -n | -k ] DESCRIPTION
The inotify cron daemon (incrond) is a daemon which monitors filesystem events and executes commands defined in system and user tables. It's use is generally similar to cron(8). incrond can be started from /etc/rc, /etc/rc.local and so on. It daemonizes itself (returns immediately) and doesn't need to be started with & and through nohup(1). It can be run on foreground too. incrond uses two categories of tables incrontab(5). System tables are usually located in /etc/incron.d and are maintained outside of incron (e.g. by various applications). These tables work on root rights level and thus any file may be watched and commands are executed with root privileges. User tables are located in /var/spool/incron by default and have names based on user accounts. These tables use users' access rights, thus only files which the user may access are watched. Commands are executed with users' privileges. If a table (incrontab) is changed incrond reacts immediately and reloads the table. Currently running child processes (commands) are not affected. There are two files determining whether an user is allowed to use incron. These files have very simple syntax - one user name per line. If /etc/incron.allow exists the user must be noted there to be allowed to use incron. Otherwise if /etc/incron.deny exists the user must not be noted there to use incron. If none of these files exists there is no other restriction whether anybody may use incron. Location of these files can be changed in the configuration. The daemon itself is currently not protected against looping. If a command executed due to an event causes the same event it leads to an infinite loop unless a flag mask containing IN_NO_LOOP is specified. Please beware of this and do not allow permission for use incron to unreliable users. -n (or --foreground) option causes running on foreground. This is useful especially for testing, debugging and optimization. -k (or --kill) option terminates a running instance of incrond. -f <FILE> (or --config=<FILE>) option specifies another location for the configuration file (/etc/incron.conf is used by default). Environment variables: For system tables, the default (the same as for incrond itself) environment variable set is used. The same applies to root's table. For non-root user tables, the whole environment is cleared and then only these variables are set: LOGNAME, USER, USERNAME, SHELL, HOME and PATH. The variables (except PATH) take values from the user database (e.g. /etc/passwd). The PATH variable is set to /usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin. SEE ALSO
incrontab(1), incrontab(5), incron.conf(5) BUGS
incrond is currently not resistent against looping. Recursive monitoring (whole subtrees) has not been implemented yet. AUTHOR
Lukas Jelinek <lukas@aiken.cz> (please report bugs to http://bts.aiken.cz or <bugs@aiken.cz>). COPYING
This program is free software. It can be used, redistributed and/or modified under the terms of the GNU General Public License, version 2. Lukas Jelinek 0.5.10 incrond(8)
All times are GMT -4. The time now is 09:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy