How do I run a script every time I save a file in Linux?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Linux has a subsystem call inotify which can cause filesystems to report changes in the filesystem to applications.
Your linux system probably has a package called
incronwhich makes usinginotifyvery easy. (Or search your available packages for any package whose description contains the word ‘inotify’).Setting up
incronis very much like setting upcron, except whereascronexecutes a script at a specified time and date,incronexecutes a script whenever a specified file or directory changes.PS. On Ubuntu (for example),
incronis this package and is installed with