Execute command when a file changes
I have a scenario where I am uploading .csv files to a specific folder, /tmp/data_upload, every day, and the old files are replaced by the new one.
I need to run a Python script once the data is uploaded. For this, I have an idea to create a cron job and monitor the changes in the file. I tried using inotify, but I am not much into the Unix domain. How can I do that?
I need to execute the script test.py once there is a date change of a file in the upload folder, for example, /tmp/data_upload.
linux unix cron automation inotify
add a comment |
I have a scenario where I am uploading .csv files to a specific folder, /tmp/data_upload, every day, and the old files are replaced by the new one.
I need to run a Python script once the data is uploaded. For this, I have an idea to create a cron job and monitor the changes in the file. I tried using inotify, but I am not much into the Unix domain. How can I do that?
I need to execute the script test.py once there is a date change of a file in the upload folder, for example, /tmp/data_upload.
linux unix cron automation inotify
Have you looked at eradman.com/entrproject , haven't tried it myself but it looks like it may be related.
– O.O.
Jan 7 at 11:57
FYI, Python hasinotify
libraries available. See one of my answers here for an example: askubuntu.com/a/939392/295286
– Sergiy Kolodyazhnyy
Jan 8 at 2:11
add a comment |
I have a scenario where I am uploading .csv files to a specific folder, /tmp/data_upload, every day, and the old files are replaced by the new one.
I need to run a Python script once the data is uploaded. For this, I have an idea to create a cron job and monitor the changes in the file. I tried using inotify, but I am not much into the Unix domain. How can I do that?
I need to execute the script test.py once there is a date change of a file in the upload folder, for example, /tmp/data_upload.
linux unix cron automation inotify
I have a scenario where I am uploading .csv files to a specific folder, /tmp/data_upload, every day, and the old files are replaced by the new one.
I need to run a Python script once the data is uploaded. For this, I have an idea to create a cron job and monitor the changes in the file. I tried using inotify, but I am not much into the Unix domain. How can I do that?
I need to execute the script test.py once there is a date change of a file in the upload folder, for example, /tmp/data_upload.
linux unix cron automation inotify
linux unix cron automation inotify
edited Jan 7 at 17:45
Peter Mortensen
2,11742124
2,11742124
asked Jan 7 at 8:29
AlexAlex
463
463
Have you looked at eradman.com/entrproject , haven't tried it myself but it looks like it may be related.
– O.O.
Jan 7 at 11:57
FYI, Python hasinotify
libraries available. See one of my answers here for an example: askubuntu.com/a/939392/295286
– Sergiy Kolodyazhnyy
Jan 8 at 2:11
add a comment |
Have you looked at eradman.com/entrproject , haven't tried it myself but it looks like it may be related.
– O.O.
Jan 7 at 11:57
FYI, Python hasinotify
libraries available. See one of my answers here for an example: askubuntu.com/a/939392/295286
– Sergiy Kolodyazhnyy
Jan 8 at 2:11
Have you looked at eradman.com/entrproject , haven't tried it myself but it looks like it may be related.
– O.O.
Jan 7 at 11:57
Have you looked at eradman.com/entrproject , haven't tried it myself but it looks like it may be related.
– O.O.
Jan 7 at 11:57
FYI, Python has
inotify
libraries available. See one of my answers here for an example: askubuntu.com/a/939392/295286– Sergiy Kolodyazhnyy
Jan 8 at 2:11
FYI, Python has
inotify
libraries available. See one of my answers here for an example: askubuntu.com/a/939392/295286– Sergiy Kolodyazhnyy
Jan 8 at 2:11
add a comment |
4 Answers
4
active
oldest
votes
You might need incrond (inotify cron daemon) which will monitors changes on files and then execute scripts.
Incrond can monitor add new file, modify, delete and many more. This is an article shows what event incrond can monitor with some example.
Example for your case, you might create the file /etc/incron.d/data_upload
with the contents
/tmp/data_upload IN_CREATE,IN_MODIFY /path/to/test.py
2
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
– Gerald Schneider
Jan 7 at 9:10
Thanks for reminding me, I have added the context for the link.
– victoroloan
Jan 7 at 9:19
Thanks for the answer, just to verify the steps after installing incrontab shoudl executeincrontab -e
as root then include this line/tmp/data_upload IN_CREATE,IN_MODIFY test.py
? so that to check once I upload a new file it should execute the test.py file ? where should I place the test.py file ? should i need to provide absolute path for this ?
– Alex
Jan 7 at 9:56
1
I think, It will be better to put the absolute path for your script. You can also check cron or system log if the script seems not working
– victoroloan
Jan 7 at 10:18
Can you also document what file you are referring to with your code block, people who are not familiar with the syntax of Incrond (like me) may think are referring to a command that you have to execute on the command line
– Ferrybig
Jan 7 at 15:08
|
show 1 more comment
You could use entr to automatically run the script everytime a file changes by running ls /tmp/data_upload | entr -p script.py
once at startup.
Project website: http://eradman.com/entrproject/
Online man page: https://www.systutorials.com/docs/linux/man/1-entr/
add a comment |
The watchexec
(https://crates.io/crates/watchexec) command line utility sounds like exactly what you need, although I believe to install it you'd need to have the Rust build tools installed on your machine, so that may be a dealbreaker
I love using software written in rust because you know it wasn't abandoned in 2004 or something. It almost has to be new.
– Nathaniel Pisarski
Jan 8 at 2:25
add a comment |
My general approach would be to fiddle with the classical Unix find
utility. For example, the command
find /tmp/upload_data/*.csv -mtime -1 -exec /home/myname/test.py
will find any .csv
files in /tmp/upload_data
that have been modified less than one day ago, and run your test.py
if it finds any. Of course, if your test.py
file is in some other directory, you want to update your path to it accordingly.
If you run your cron
job more often than once a day, you can use the mmin
option to find
to specify the maximal time since modification in minutes. For example,
find /tmp/upload_data/*.csv -mmin -60 -exec /home/myname/test.py
will search for .csv
files that were modified less than 60 minutes ago -- useful if cron runs the job hourly.
Two fair warnings are in order: First, this won't catch .csv
files that you entirely deleted. You may want to check for these separately. Second, I did not have time to test any of this. Expect typos in my code that you'll have to debug by yourself.
1
What is the-cmd
syntax? IIRCfind
takes-exec cmd ;
...
– D. Ben Knoble
Jan 8 at 4:28
I have tried this one before posting this question ,this is not working properly on 2nd 3rd consecutive run of cron jobs
– Alex
Jan 8 at 7:31
@D. Ben Knoble: You're right. I mixed up find-internal commands with shell commands. Fixed. Thanks for the correction!
– Thomas Blankenhorn
Jan 8 at 8:37
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "2"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f947868%2fexecute-command-when-a-file-changes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
4 Answers
4
active
oldest
votes
4 Answers
4
active
oldest
votes
active
oldest
votes
active
oldest
votes
You might need incrond (inotify cron daemon) which will monitors changes on files and then execute scripts.
Incrond can monitor add new file, modify, delete and many more. This is an article shows what event incrond can monitor with some example.
Example for your case, you might create the file /etc/incron.d/data_upload
with the contents
/tmp/data_upload IN_CREATE,IN_MODIFY /path/to/test.py
2
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
– Gerald Schneider
Jan 7 at 9:10
Thanks for reminding me, I have added the context for the link.
– victoroloan
Jan 7 at 9:19
Thanks for the answer, just to verify the steps after installing incrontab shoudl executeincrontab -e
as root then include this line/tmp/data_upload IN_CREATE,IN_MODIFY test.py
? so that to check once I upload a new file it should execute the test.py file ? where should I place the test.py file ? should i need to provide absolute path for this ?
– Alex
Jan 7 at 9:56
1
I think, It will be better to put the absolute path for your script. You can also check cron or system log if the script seems not working
– victoroloan
Jan 7 at 10:18
Can you also document what file you are referring to with your code block, people who are not familiar with the syntax of Incrond (like me) may think are referring to a command that you have to execute on the command line
– Ferrybig
Jan 7 at 15:08
|
show 1 more comment
You might need incrond (inotify cron daemon) which will monitors changes on files and then execute scripts.
Incrond can monitor add new file, modify, delete and many more. This is an article shows what event incrond can monitor with some example.
Example for your case, you might create the file /etc/incron.d/data_upload
with the contents
/tmp/data_upload IN_CREATE,IN_MODIFY /path/to/test.py
2
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
– Gerald Schneider
Jan 7 at 9:10
Thanks for reminding me, I have added the context for the link.
– victoroloan
Jan 7 at 9:19
Thanks for the answer, just to verify the steps after installing incrontab shoudl executeincrontab -e
as root then include this line/tmp/data_upload IN_CREATE,IN_MODIFY test.py
? so that to check once I upload a new file it should execute the test.py file ? where should I place the test.py file ? should i need to provide absolute path for this ?
– Alex
Jan 7 at 9:56
1
I think, It will be better to put the absolute path for your script. You can also check cron or system log if the script seems not working
– victoroloan
Jan 7 at 10:18
Can you also document what file you are referring to with your code block, people who are not familiar with the syntax of Incrond (like me) may think are referring to a command that you have to execute on the command line
– Ferrybig
Jan 7 at 15:08
|
show 1 more comment
You might need incrond (inotify cron daemon) which will monitors changes on files and then execute scripts.
Incrond can monitor add new file, modify, delete and many more. This is an article shows what event incrond can monitor with some example.
Example for your case, you might create the file /etc/incron.d/data_upload
with the contents
/tmp/data_upload IN_CREATE,IN_MODIFY /path/to/test.py
You might need incrond (inotify cron daemon) which will monitors changes on files and then execute scripts.
Incrond can monitor add new file, modify, delete and many more. This is an article shows what event incrond can monitor with some example.
Example for your case, you might create the file /etc/incron.d/data_upload
with the contents
/tmp/data_upload IN_CREATE,IN_MODIFY /path/to/test.py
edited Jan 8 at 8:43
Jenny D
23.5k116094
23.5k116094
answered Jan 7 at 9:09
victoroloanvictoroloan
1664
1664
2
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
– Gerald Schneider
Jan 7 at 9:10
Thanks for reminding me, I have added the context for the link.
– victoroloan
Jan 7 at 9:19
Thanks for the answer, just to verify the steps after installing incrontab shoudl executeincrontab -e
as root then include this line/tmp/data_upload IN_CREATE,IN_MODIFY test.py
? so that to check once I upload a new file it should execute the test.py file ? where should I place the test.py file ? should i need to provide absolute path for this ?
– Alex
Jan 7 at 9:56
1
I think, It will be better to put the absolute path for your script. You can also check cron or system log if the script seems not working
– victoroloan
Jan 7 at 10:18
Can you also document what file you are referring to with your code block, people who are not familiar with the syntax of Incrond (like me) may think are referring to a command that you have to execute on the command line
– Ferrybig
Jan 7 at 15:08
|
show 1 more comment
2
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
– Gerald Schneider
Jan 7 at 9:10
Thanks for reminding me, I have added the context for the link.
– victoroloan
Jan 7 at 9:19
Thanks for the answer, just to verify the steps after installing incrontab shoudl executeincrontab -e
as root then include this line/tmp/data_upload IN_CREATE,IN_MODIFY test.py
? so that to check once I upload a new file it should execute the test.py file ? where should I place the test.py file ? should i need to provide absolute path for this ?
– Alex
Jan 7 at 9:56
1
I think, It will be better to put the absolute path for your script. You can also check cron or system log if the script seems not working
– victoroloan
Jan 7 at 10:18
Can you also document what file you are referring to with your code block, people who are not familiar with the syntax of Incrond (like me) may think are referring to a command that you have to execute on the command line
– Ferrybig
Jan 7 at 15:08
2
2
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
– Gerald Schneider
Jan 7 at 9:10
Whilst this may theoretically answer the question, it would be preferable to include the essential parts of the answer here, and provide the link for reference.
– Gerald Schneider
Jan 7 at 9:10
Thanks for reminding me, I have added the context for the link.
– victoroloan
Jan 7 at 9:19
Thanks for reminding me, I have added the context for the link.
– victoroloan
Jan 7 at 9:19
Thanks for the answer, just to verify the steps after installing incrontab shoudl execute
incrontab -e
as root then include this line /tmp/data_upload IN_CREATE,IN_MODIFY test.py
? so that to check once I upload a new file it should execute the test.py file ? where should I place the test.py file ? should i need to provide absolute path for this ?– Alex
Jan 7 at 9:56
Thanks for the answer, just to verify the steps after installing incrontab shoudl execute
incrontab -e
as root then include this line /tmp/data_upload IN_CREATE,IN_MODIFY test.py
? so that to check once I upload a new file it should execute the test.py file ? where should I place the test.py file ? should i need to provide absolute path for this ?– Alex
Jan 7 at 9:56
1
1
I think, It will be better to put the absolute path for your script. You can also check cron or system log if the script seems not working
– victoroloan
Jan 7 at 10:18
I think, It will be better to put the absolute path for your script. You can also check cron or system log if the script seems not working
– victoroloan
Jan 7 at 10:18
Can you also document what file you are referring to with your code block, people who are not familiar with the syntax of Incrond (like me) may think are referring to a command that you have to execute on the command line
– Ferrybig
Jan 7 at 15:08
Can you also document what file you are referring to with your code block, people who are not familiar with the syntax of Incrond (like me) may think are referring to a command that you have to execute on the command line
– Ferrybig
Jan 7 at 15:08
|
show 1 more comment
You could use entr to automatically run the script everytime a file changes by running ls /tmp/data_upload | entr -p script.py
once at startup.
Project website: http://eradman.com/entrproject/
Online man page: https://www.systutorials.com/docs/linux/man/1-entr/
add a comment |
You could use entr to automatically run the script everytime a file changes by running ls /tmp/data_upload | entr -p script.py
once at startup.
Project website: http://eradman.com/entrproject/
Online man page: https://www.systutorials.com/docs/linux/man/1-entr/
add a comment |
You could use entr to automatically run the script everytime a file changes by running ls /tmp/data_upload | entr -p script.py
once at startup.
Project website: http://eradman.com/entrproject/
Online man page: https://www.systutorials.com/docs/linux/man/1-entr/
You could use entr to automatically run the script everytime a file changes by running ls /tmp/data_upload | entr -p script.py
once at startup.
Project website: http://eradman.com/entrproject/
Online man page: https://www.systutorials.com/docs/linux/man/1-entr/
answered Jan 7 at 13:48
jln-hojln-ho
111
111
add a comment |
add a comment |
The watchexec
(https://crates.io/crates/watchexec) command line utility sounds like exactly what you need, although I believe to install it you'd need to have the Rust build tools installed on your machine, so that may be a dealbreaker
I love using software written in rust because you know it wasn't abandoned in 2004 or something. It almost has to be new.
– Nathaniel Pisarski
Jan 8 at 2:25
add a comment |
The watchexec
(https://crates.io/crates/watchexec) command line utility sounds like exactly what you need, although I believe to install it you'd need to have the Rust build tools installed on your machine, so that may be a dealbreaker
I love using software written in rust because you know it wasn't abandoned in 2004 or something. It almost has to be new.
– Nathaniel Pisarski
Jan 8 at 2:25
add a comment |
The watchexec
(https://crates.io/crates/watchexec) command line utility sounds like exactly what you need, although I believe to install it you'd need to have the Rust build tools installed on your machine, so that may be a dealbreaker
The watchexec
(https://crates.io/crates/watchexec) command line utility sounds like exactly what you need, although I believe to install it you'd need to have the Rust build tools installed on your machine, so that may be a dealbreaker
answered Jan 7 at 15:31
Ben SandeenBen Sandeen
1011
1011
I love using software written in rust because you know it wasn't abandoned in 2004 or something. It almost has to be new.
– Nathaniel Pisarski
Jan 8 at 2:25
add a comment |
I love using software written in rust because you know it wasn't abandoned in 2004 or something. It almost has to be new.
– Nathaniel Pisarski
Jan 8 at 2:25
I love using software written in rust because you know it wasn't abandoned in 2004 or something. It almost has to be new.
– Nathaniel Pisarski
Jan 8 at 2:25
I love using software written in rust because you know it wasn't abandoned in 2004 or something. It almost has to be new.
– Nathaniel Pisarski
Jan 8 at 2:25
add a comment |
My general approach would be to fiddle with the classical Unix find
utility. For example, the command
find /tmp/upload_data/*.csv -mtime -1 -exec /home/myname/test.py
will find any .csv
files in /tmp/upload_data
that have been modified less than one day ago, and run your test.py
if it finds any. Of course, if your test.py
file is in some other directory, you want to update your path to it accordingly.
If you run your cron
job more often than once a day, you can use the mmin
option to find
to specify the maximal time since modification in minutes. For example,
find /tmp/upload_data/*.csv -mmin -60 -exec /home/myname/test.py
will search for .csv
files that were modified less than 60 minutes ago -- useful if cron runs the job hourly.
Two fair warnings are in order: First, this won't catch .csv
files that you entirely deleted. You may want to check for these separately. Second, I did not have time to test any of this. Expect typos in my code that you'll have to debug by yourself.
1
What is the-cmd
syntax? IIRCfind
takes-exec cmd ;
...
– D. Ben Knoble
Jan 8 at 4:28
I have tried this one before posting this question ,this is not working properly on 2nd 3rd consecutive run of cron jobs
– Alex
Jan 8 at 7:31
@D. Ben Knoble: You're right. I mixed up find-internal commands with shell commands. Fixed. Thanks for the correction!
– Thomas Blankenhorn
Jan 8 at 8:37
add a comment |
My general approach would be to fiddle with the classical Unix find
utility. For example, the command
find /tmp/upload_data/*.csv -mtime -1 -exec /home/myname/test.py
will find any .csv
files in /tmp/upload_data
that have been modified less than one day ago, and run your test.py
if it finds any. Of course, if your test.py
file is in some other directory, you want to update your path to it accordingly.
If you run your cron
job more often than once a day, you can use the mmin
option to find
to specify the maximal time since modification in minutes. For example,
find /tmp/upload_data/*.csv -mmin -60 -exec /home/myname/test.py
will search for .csv
files that were modified less than 60 minutes ago -- useful if cron runs the job hourly.
Two fair warnings are in order: First, this won't catch .csv
files that you entirely deleted. You may want to check for these separately. Second, I did not have time to test any of this. Expect typos in my code that you'll have to debug by yourself.
1
What is the-cmd
syntax? IIRCfind
takes-exec cmd ;
...
– D. Ben Knoble
Jan 8 at 4:28
I have tried this one before posting this question ,this is not working properly on 2nd 3rd consecutive run of cron jobs
– Alex
Jan 8 at 7:31
@D. Ben Knoble: You're right. I mixed up find-internal commands with shell commands. Fixed. Thanks for the correction!
– Thomas Blankenhorn
Jan 8 at 8:37
add a comment |
My general approach would be to fiddle with the classical Unix find
utility. For example, the command
find /tmp/upload_data/*.csv -mtime -1 -exec /home/myname/test.py
will find any .csv
files in /tmp/upload_data
that have been modified less than one day ago, and run your test.py
if it finds any. Of course, if your test.py
file is in some other directory, you want to update your path to it accordingly.
If you run your cron
job more often than once a day, you can use the mmin
option to find
to specify the maximal time since modification in minutes. For example,
find /tmp/upload_data/*.csv -mmin -60 -exec /home/myname/test.py
will search for .csv
files that were modified less than 60 minutes ago -- useful if cron runs the job hourly.
Two fair warnings are in order: First, this won't catch .csv
files that you entirely deleted. You may want to check for these separately. Second, I did not have time to test any of this. Expect typos in my code that you'll have to debug by yourself.
My general approach would be to fiddle with the classical Unix find
utility. For example, the command
find /tmp/upload_data/*.csv -mtime -1 -exec /home/myname/test.py
will find any .csv
files in /tmp/upload_data
that have been modified less than one day ago, and run your test.py
if it finds any. Of course, if your test.py
file is in some other directory, you want to update your path to it accordingly.
If you run your cron
job more often than once a day, you can use the mmin
option to find
to specify the maximal time since modification in minutes. For example,
find /tmp/upload_data/*.csv -mmin -60 -exec /home/myname/test.py
will search for .csv
files that were modified less than 60 minutes ago -- useful if cron runs the job hourly.
Two fair warnings are in order: First, this won't catch .csv
files that you entirely deleted. You may want to check for these separately. Second, I did not have time to test any of this. Expect typos in my code that you'll have to debug by yourself.
edited Jan 8 at 8:48
answered Jan 8 at 1:12
Thomas BlankenhornThomas Blankenhorn
1012
1012
1
What is the-cmd
syntax? IIRCfind
takes-exec cmd ;
...
– D. Ben Knoble
Jan 8 at 4:28
I have tried this one before posting this question ,this is not working properly on 2nd 3rd consecutive run of cron jobs
– Alex
Jan 8 at 7:31
@D. Ben Knoble: You're right. I mixed up find-internal commands with shell commands. Fixed. Thanks for the correction!
– Thomas Blankenhorn
Jan 8 at 8:37
add a comment |
1
What is the-cmd
syntax? IIRCfind
takes-exec cmd ;
...
– D. Ben Knoble
Jan 8 at 4:28
I have tried this one before posting this question ,this is not working properly on 2nd 3rd consecutive run of cron jobs
– Alex
Jan 8 at 7:31
@D. Ben Knoble: You're right. I mixed up find-internal commands with shell commands. Fixed. Thanks for the correction!
– Thomas Blankenhorn
Jan 8 at 8:37
1
1
What is the
-cmd
syntax? IIRC find
takes -exec cmd ;
...– D. Ben Knoble
Jan 8 at 4:28
What is the
-cmd
syntax? IIRC find
takes -exec cmd ;
...– D. Ben Knoble
Jan 8 at 4:28
I have tried this one before posting this question ,this is not working properly on 2nd 3rd consecutive run of cron jobs
– Alex
Jan 8 at 7:31
I have tried this one before posting this question ,this is not working properly on 2nd 3rd consecutive run of cron jobs
– Alex
Jan 8 at 7:31
@D. Ben Knoble: You're right. I mixed up find-internal commands with shell commands. Fixed. Thanks for the correction!
– Thomas Blankenhorn
Jan 8 at 8:37
@D. Ben Knoble: You're right. I mixed up find-internal commands with shell commands. Fixed. Thanks for the correction!
– Thomas Blankenhorn
Jan 8 at 8:37
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f947868%2fexecute-command-when-a-file-changes%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Have you looked at eradman.com/entrproject , haven't tried it myself but it looks like it may be related.
– O.O.
Jan 7 at 11:57
FYI, Python has
inotify
libraries available. See one of my answers here for an example: askubuntu.com/a/939392/295286– Sergiy Kolodyazhnyy
Jan 8 at 2:11