Unix & Linux Stack Exchange
Q&A for users of Linux, FreeBSD and other Unix-like operating systems
Latest Questions
1
votes
2
answers
1878
views
Incrontab does not execute command
When I use incrontab out of the box, I mean no changes, I get no result, as if the command was not executed. my incron line is : `/crrae IN_CREATE,IN_CLOSE_WRITE,IN_MOVED_TO /usr/bin/unix2dos $#` the log give information as if everything was ok but no actually the strace generated is: `incrontab_tra...
When I use incrontab out of the box, I mean no changes,
I get no result, as if the command was not executed.
my incron line is :
/crrae IN_CREATE,IN_CLOSE_WRITE,IN_MOVED_TO /usr/bin/unix2dos $#
the log give information as if everything was ok but no actually
the strace generated is: incrontab_trace_0.txt
0.000000 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 ([{fd=8, revents=POLLIN}])
17.616276 read(8, "\1\0\0\0\0\1\0\0\0\0\0\0000\0\0\0ExportSageJDE_CO"..., 32768) = 64
0.000145 stat64("/crrae", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
0.000147 time(NULL) = 1399228077
0.000056 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000089 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000082 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000096 send(3, "May 4 18:27:57 incrond[3183"..., 108, MSG_NOSIGNAL) = 108
0.000104 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f60718) = 31838
0.000816 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = -1 EINTR (Interrupted system call)
0.000834 --- SIGCHLD (Child exited) @ 0 (0) ---
0.000033 read(4, 0x8069c40, 32) = -1 EAGAIN (Resource temporarily unavailable)
0.000057 write(5, "X", 1) = 1
0.000056 sigreturn() = ? (mask now [])
0.000072 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 ([{fd=4, revents=POLLIN}])
0.000068 read(4, "X", 1) = 1
0.000054 read(4, 0xbfd22dd9, 1) = -1 EAGAIN (Resource temporarily unavailable)
0.000057 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], WNOHANG) = 31838
0.000060 waitpid(-1, 0xbfd22dd4, WNOHANG) = -1 ECHILD (No child processes)
0.000051 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 ([{fd=8, revents=POLLIN}])
0.009198 read(8, "\1\0\0\0\10\0\0\0\0\0\0\0000\0\0\0ExportSageJDE_CO"..., 32768) = 64
0.000074 stat64("/crrae", {st_mode=S_IFDIR|0777, st_size=4096, ...}) = 0
0.000118 time(NULL) = 1399228077
0.000057 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000084 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000082 stat64("/etc/localtime", {st_mode=S_IFREG|0644, st_size=156, ...}) = 0
0.000090 send(3, "May 4 18:27:57 incrond[3183"..., 108, MSG_NOSIGNAL) = 108
0.000065 clone(child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, child_tidptr=0xb7f60718) = 31839
0.000614 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = -1 EINTR (Interrupted system call)
0.000832 --- SIGCHLD (Child exited) @ 0 (0) ---
0.000026 read(4, 0x8069c40, 32) = -1 EAGAIN (Resource temporarily unavailable)
0.000055 write(5, "X", 1) = 1
0.000054 sigreturn() = ? (mask now [])
0.000071 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1) = 1 ([{fd=4, revents=POLLIN}])
0.000067 read(4, "X", 1) = 1
0.000053 read(4, 0xbfd22dd9, 1) = -1 EAGAIN (Resource temporarily unavailable)
0.000051 waitpid(-1, [{WIFEXITED(s) && WEXITSTATUS(s) == 1}], WNOHANG) = 31839
0.000058 waitpid(-1, 0xbfd22dd4, WNOHANG) = -1 ECHILD (No child processes)
0.000050 poll([{fd=4, events=POLLIN}, {fd=6, events=POLLIN}, {fd=8, events=POLLIN}], 3, -1
When I change my incron to:
/crrae IN_CREATE,IN_CLOSE_WRITE,IN_MOVED_TO /usr/bin/unix2dos /crrae/$#
or
/crrae IN_CREATE,IN_CLOSE_WRITE,IN_MOVED_TO /usr/bin/unix2dos $@/$#
the log gives me this:
May 4 18:15:10 srvovs incrond: (root) CMD (/usr/bin/unix2dos /crrae/u2dtmpPbqoFd)
May 4 18:15:10 srvovs incrond: (root) CMD (/usr/bin/unix2dos /crrae/u2dtmpN2Odxf)
May 4 18:15:10 srvovs incrond: (root) CMD (/usr/bin/unix2dos /crrae/u2dtmpN2Odxf)
multiple times, the incron.conf
has not been modified.
Any ideas?
user3545361
(23 rep)
May 5, 2014, 09:56 AM
• Last activity: Jul 11, 2025, 05:03 AM
0
votes
1
answers
499
views
Ubuntu: User 'uname' is not allowed to use [tool]
I found this cool tool called "incron." I think it will be a great productivity booster, but I am having issues getting it to run. ``` sudo apt-get install incron ... Adding group `incron' ... sudo usermod -a -G incron myname # no luck ``` ``` incrontab -e # user 'myname' is not allowed to use incro...
I found this cool tool called "incron." I think it will be a great productivity booster, but I am having issues getting it to run.
sudo apt-get install incron
...
Adding group `incron'
...
sudo usermod -a -G incron myname # no luck
incrontab -e # user 'myname' is not allowed to use incron
___
This seems to be a pretty cut and dry problem -- I should be able to get it to "just work"; however, it is not. Is there an easy way to get this running?
Chris
(1075 rep)
Oct 19, 2020, 10:33 PM
• Last activity: Sep 26, 2024, 04:26 PM
0
votes
1
answers
142
views
Incron commands with arguments
I know cron can execute commands with arguments and the documentation implies that incron can as well, but it doesn't give examples. I tried using incron with arguments like this ``` /home/alex/texmf/tex/latex/commonstuff/cttools.sty IN_MODIFY,IN_CREATE /bin/bash /home/alex/bashscripts/luatoxe /home...
I know cron can execute commands with arguments and the documentation implies that incron can as well, but it doesn't give examples. I tried using incron with arguments like this
/home/alex/texmf/tex/latex/commonstuff/cttools.sty IN_MODIFY,IN_CREATE /bin/bash /home/alex/bashscripts/luatoxe /home/alex/texmf/tex/latex/commonstuff/cttools.sty
and in a few variations but it doesn't seem to work at all. So how do I specify arguments for incron right? For completeness, luatoxe
is the script
#!/bin/bash
cp $1 x$1
sed -i "/setmainfont/"' s/^/%/' "x$1"
sed -i "/setmathfont/"' s/^/%/' "x$1"
I also made a variant luatoxect
where I specify the file path to cttools
in the file itself, which works if I use it with incron.
Alexander Praehauser
(221 rep)
Oct 3, 2023, 03:45 PM
• Last activity: Oct 3, 2023, 03:49 PM
2
votes
1
answers
1028
views
incrontab: modify a modified file
With `incrontab`, I want to monitor a file and whenever it gets modified, I want to replace a string in it. But that will create an infinite loop, I guess. When I configure it with the following table: /etc/file.md IN_MODIFY sed -i 's/Hello/Hi/g' $@ It works once, but never again. I don't see any er...
With
incrontab
, I want to monitor a file and whenever it gets modified, I want to replace a string in it. But that will create an infinite loop, I guess. When I configure it with the following table:
/etc/file.md IN_MODIFY sed -i 's/Hello/Hi/g' $@
It works once, but never again. I don't see any error messages and the status of incrond
remains fine, but I think the service is stuck in an infinite loop. If I restart it, it will work again one single time.
Is there a way to prevent such an infinite loop? Or is there another approach to my problem?
stackprotector
(870 rep)
Jul 14, 2022, 08:28 AM
• Last activity: Jul 14, 2022, 11:45 AM
6
votes
2
answers
11344
views
User's incrontab not working (only root's) when incrond is run as a service
Here is my incrontab (tony's incrontab): /home/tony/Workspace/cocoonr/ui/static/ui/img/icons/vector IN_MODIFY,IN_CREATE,IN_MOVED_TO /bin/sh /home/tony/Workspace/cocoonr/boilerplate/svg2djangohtml $@/$# /home/tony/Workspace/cocoonr/ui/templates/inc/icons/ I tested it multiple times changing some thin...
Here is my incrontab (tony's incrontab):
/home/tony/Workspace/cocoonr/ui/static/ui/img/icons/vector IN_MODIFY,IN_CREATE,IN_MOVED_TO /bin/sh /home/tony/Workspace/cocoonr/boilerplate/svg2djangohtml $@/$# /home/tony/Workspace/cocoonr/ui/templates/inc/icons/
I tested it multiple times changing some things, no way to make it work when incrond is run as a service (using openrc).
If I run incrond in foreground (
incrond -n
), then tony's incrontab works
If I set root's incrontab to the one given above, it works even when run as a service.
My tony is in /etc/incron.allow
:
root
tony
And there is no /etc/incron.deny
.
I even tried with a much simpler incrontab:
/tmp/foo IN_ATTRIB touch /tmp/bar
The results are the same.
How to make user's incrontab working?
Antoine Pinsard
(131 rep)
Jun 20, 2016, 07:14 PM
• Last activity: May 31, 2022, 10:03 PM
0
votes
1
answers
612
views
Incrontab / Incron on Cygwin
Does anyone please know if it is possible to install incron/incrontab within Cygwin? I've had a look and the package does not appear on the cygwin website, I wondered if anyone had tried, knew of any method or had any success?
Does anyone please know if it is possible to install incron/incrontab within Cygwin?
I've had a look and the package does not appear on the cygwin website, I wondered if anyone had tried, knew of any method or had any success?
questions
(3 rep)
Apr 27, 2015, 01:47 PM
• Last activity: Aug 21, 2020, 02:34 PM
2
votes
1
answers
657
views
incrontab is not triggering with end of cron sh invokes
I have this incrontab, which is monitoring the `master` Directory to check if the event occurs where a new file is placed here ... and run the php file. /var/www/html/docs/int/master IN_MOVE php /var/www/html/shscript/work.php I have a crontab that runs every one minute, and invokes the execution of...
I have this incrontab, which is monitoring the
master
Directory to check if the event occurs where a new file is placed here ... and run the php file.
/var/www/html/docs/int/master IN_MOVE php /var/www/html/shscript/work.php
I have a crontab that runs every one minute, and invokes the execution of a .sh
file, the content of this SH is to copy the txt files to the Master directory that is in the previous incrontab (that work well):
cd /mnt/test1/int/master
cp *.txt /var/www/html/docs/int/master
The probllem:
when the cron is end of run (copy is successfull), but the icron is not triggering, no detecting event like: IN_MOVE, IN_MOVED_TO
; but if i change the event to: IN_MODIFY
; Work well and execute the php file; but i not need to run the php file on modify event i need run it if the file is succefull copy.
**I do not know what I'm doing wrong.**
Minos Framework
(141 rep)
Aug 6, 2020, 08:27 PM
• Last activity: Aug 7, 2020, 01:32 PM
0
votes
2
answers
501
views
How to do find and replace strings on file after it is being modified
Trying to achieve following: 1) New file gets uploaded with the same file name but with new content 2) Event triggers that checks the file for specific strings and replaces them 3) The file can be saved in place(might be a loop) or new copy of the file is created with the modifications. For the even...
Trying to achieve following:
1) New file gets uploaded with the same file name but with new content
2) Event triggers that checks the file for specific strings and replaces them
3) The file can be saved in place(might be a loop) or new copy of the file is created with the modifications.
For the event catching tried to use direvent and incron, both can catch the event however there are problems with launching the commands to find and replace the strings in that file.
For the find and replace functionality tried to use sed and perl.
SED+INCRON:
/path to file folder/ IN_MODIFY /bin/sed -i 's+/pub/+/+g' filename.xml
DIREVENT+PERL:
direvent.conf content
watcher {
path /path to file/;
event write;
command "/usr/bin/perl script.pl";
}
script.pl content
#!/usr/bin/perl
use strict;
use warnings;
perl -pe 's/old_string/new_string' filename.xml
Could someone suggest an idea?
Lauris Kārkliņš
(1 rep)
May 30, 2020, 05:18 PM
• Last activity: Jul 17, 2020, 02:07 PM
1
votes
1
answers
849
views
incrontab on folder name containing line feeds
I'm writing a script searching for directories in a subtree and appending them to `incrontab`. I can even add folder names with blanks by escaping those with a backslash: /path/to/observed\ directory IN_ALL_EVENTS /path/to/script.sh "\$@" "\$#" "\$%" However, I have no clue how to add a folder conta...
I'm writing a script searching for directories in a subtree and appending them to
incrontab
. I can even add folder names with blanks by escaping those with a backslash:
/path/to/observed\ directory IN_ALL_EVENTS /path/to/script.sh "\$@" "\$#" "\$%"
However, I have no clue how to add a folder containing a line feed character. None of the following works:
/path/to/observed\ndirectory IN_ALL_EVENTS /path/to/script.sh "\$@" "\$#" "\$%"
/path/to/observed\
directory IN_ALL_EVENTS /path/to/script.sh "\$@" "\$#" "\$%"
"/path/to/observed
directory IN_ALL_EVENTS /path/to/script.sh" "\$@" "\$#" "\$%"
Is there any possibility to get it work?
Pinke Helga
(331 rep)
Jun 16, 2016, 03:26 AM
• Last activity: Mar 9, 2020, 10:29 AM
2
votes
0
answers
113
views
Monitoring directory using incron
I am using incron to monitor the file creation event of a directory. It working fine but once for 4 or 5 days its getting freeze. Once it's freeze, it's not monitoring the file creation event. It started to work back once I manually restarted the incron.service. what I want is, I want to be notified...
I am using incron to monitor the file creation event of a directory. It working fine but once for 4 or 5 days its getting freeze.
Once it's freeze, it's not monitoring the file creation event. It started to work back once I manually restarted the incron.service.
what I want is, I want to be notified once incron is freeze. How do get to know incron is freezed state? How do I make a shell script to capture state of incron?
Anbarasu Subramaniyan
(121 rep)
Oct 16, 2019, 05:42 AM
• Last activity: Oct 16, 2019, 05:48 AM
0
votes
1
answers
2408
views
Errors on trigger of incrond scripts
I have incron installed on my centos 7 machine. for my initial testing, I have a simple entry in the table. When a file is moved to the target folder, it would run a script. What I did first was to execute /dir IN_MOVED_TO logger success This does not work though, when I put a file in the target fol...
I have incron installed on my centos 7 machine.
for my initial testing, I have a simple entry in the table. When a file is moved to the target folder, it would run a script. What I did first was to execute
/dir IN_MOVED_TO logger success
This does not work though, when I put a file in the target folder I see a message in the /var/logs/messages that says
Aug 14 23:29:27 Clone-Dev-AnalyticsAutomation gnome-session: gnome-session-binary: WARNING: Unable to inhibit system: GDBus.Error:org.freedesktop.DBus.Error.AccessDenied: Permission denied
Aug 14 23:29:32 Clone-Dev-AnalyticsAutomation journal: unable to create file '/run/user/1018/dconf/user': Permission denied. dconf will not work properly.
I thought incrond was started without the sudo command so I restarted it with the sudo command but I still get the same results.
I ran **service incrond status -l**
Aug 14 23:13:48 Clone-Dev incrond: loading user tables
Aug 14 23:13:48 Clone-Dev incrond: loading table for user simon
Aug 14 23:13:49 Clone-Dev incrond: loading table for user analytics
Aug 14 23:13:49 Clone-Dev incrond: loading table for user root
Aug 14 23:13:49 Clone-Dev incrond: access denied on ## - events will be discarded silently
Aug 14 23:13:49 Clone-Dev incrond: cannot create watch for user root: (22) Invalid argument
Aug 14 23:13:49 Clone-Dev incrond: access denied on ## - events will be discarded silently
Aug 14 23:13:49 Clone-Dev incrond: cannot create watch for user root: (22) Invalid argument
Aug 14 23:13:49 Clone-Dev incrond: ready to process filesystem events
I'm not really sure what's happening. I feel like incrond is trying to execute commands but does not have the necessary privileges.
chip
(153 rep)
Aug 14, 2018, 03:39 PM
• Last activity: Aug 14, 2018, 04:44 PM
3
votes
0
answers
951
views
Copying files and folders to /var/www/html - inherit permissions of ./html
I want to enforce web server security and maintain 750 for folders and 640 for files - even when copying, at all times, under all circumstances. So far, I've got this working quite well. This is what I did: `sudo chown -R kilomike ./html` (Set owner to my user, the sole user) `sudo chgrp -R apache ....
I want to enforce web server security and maintain 750 for folders and 640 for files - even when copying, at all times, under all circumstances.
So far, I've got this working quite well. This is what I did:
sudo chown -R kilomike ./html
(Set owner to my user, the sole user)
sudo chgrp -R apache ./html
(set group to apache so it can work)
sudo chmod g+s ./html
(set the group ID so new files/folders inherit the group)
sudo setfacl -d -m g::rx ./html
(only allow group to read and execute [should be safe, because file creation using touch and other methods doesn't set execute bit])
sudo setfacl -d -m o::- ./html
(don't allow other group to even look at it)
This works great for the most part. However, I just KNOW that when I copy a folder or file in to /var/www/html/* I'm going to forget to update its permissions.
What I want is 750 for folders, 640 for files, which is what I attempted to do with setfacl. Despite the fact that technically I set it to 750 (group is r-x and other is ---), I think when I create a FILE it won't (hopefully) apply the execute bit for either the owner or group. This seems to be working, as per ls -l
or getfacl
.
My problem is when I copy a folder that was created by some other user, or downloaded from the web, it will preserve the owner, group, and other permissions. I DON'T want that, as I want my /var/www/html folder to have the same permissions for EVERY file and folder inside it.
Does anyone know how to do it? Is the best way to do it with an incron
job (e.g. change on /var/www/html or any file/folder inside it, then "refresh" permissions for EVERYTHING), or is there a better way?
Kevin
(131 rep)
Dec 13, 2017, 06:05 PM
• Last activity: Dec 17, 2017, 01:54 PM
0
votes
0
answers
352
views
abrt-server sent an email to root@localhost, but there are no updates in var/mail/root
I'm debugging an issue with python and incron, when I run my script, and then checking the status, it says it has an error. then it said it sent an email to root@localhost, I'm assuming this is at /var/mail/root? When I check that file though, the last update was 10 days ago. Now I'm not sure where...
I'm debugging an issue with python and incron, when I run my script, and then checking the status, it says it has an error. then it said it sent an email to root@localhost, I'm assuming this is at /var/mail/root? When I check that file though, the last update was 10 days ago. Now I'm not sure where I should look for the detailed error message
chip
(153 rep)
Jul 31, 2017, 11:13 AM
2
votes
0
answers
1002
views
Unison and Incron shell script
I have successfully installed unison and incron. I get unison to run just fine. I'm doing this all logged in as root by the way, I figure that's how this will be executed when i'm not logged in. I'm using ssh, and have a passwordless key file. I can successfully call unison and have it sync just fin...
I have successfully installed unison and incron. I get unison to run just fine. I'm doing this all logged in as root by the way, I figure that's how this will be executed when i'm not logged in. I'm using ssh, and have a passwordless key file. I can successfully call unison and have it sync just fine. I can call the shellscript and that works too. But Nothing happens when the incron is triggered and unison is called. I also modified my incrontab to run unison directly and that doesn't work. And I don't see any errors. any help would be greatly appreciated! I'm still getting use to linux.
**Unison default.prf**
# Unison preferences file
sshargs = -i uni
batch = true
silent = true
log = true
logfile = /var/log/unison.log
root = /var/www
root = ssh://ipaddress//var/www/
path = test
ignore = Name test/sub2/suber
confirmbigdel = false
**Incrontab -e**
/var/www/test/ IN_ALL_EVENTS /root/au.sh
**au.sh**
#!/bin/bash
unison -batch
I can run my shellscript just fine. I'm adding the batch flag again just for kicks. I know that incrontab is working, I see output in the **/var/log/sys.log**
Oct 18 19:38:27 inctrg-dev-01 incrond: (root) CMD (/root/au.sh)
aibarra
(121 rep)
Oct 18, 2016, 07:42 PM
• Last activity: Oct 19, 2016, 03:56 PM
1
votes
2
answers
2567
views
Allow one entry at a time in incron job?
I have a directory to monitor. When it is updated, I run some command via incron. When multiple files are copied in this directory, incron execute multiple commands at the same time. Is there any way that when one job of incron is running, the second job should not run?. I have followed [this tutori...
I have a directory to monitor. When it is updated, I run some command via incron. When multiple files are copied in this directory, incron execute multiple commands at the same time. Is there any way that when one job of incron is running, the second job should not run?. I have followed this tutorial for guidance.
Hafiz Muhammad Shafiq
(603 rep)
Feb 17, 2016, 10:48 AM
• Last activity: Jun 16, 2016, 10:29 PM
Showing page 1 of 15 total questions