Score:0

My script from incrontab only ever works for one file

fr flag

I wrote this script:

#!/bin/bash

find /path/ -maxdepth 1 -name "*.ly" -exec lilypond -o /path/to '{}' &> /path/to/test/test.txt \;

mv /path/*.pdf /path/for/pdf
mv /path/*.midi /path/for/midi
mv /path/*.ly /path/for/lily

I made it executable, and it works properly when I use it for all files I need.

Then I tried to use incron to use that script every time there is a move on the path, modifying it with incron -e.

/path/ IN_MOVED_TO,IN_NO_LOOP /bin/bash /path/of/scripts/script.sh

It only moves one file each time the script is run, but when I put more .ly files on that path it doesn't work and it just runs once.

How can I make it work on each .ly file I put in my path?

Note that lilypond, during the compilation of .ly files, makes new files and I can't make incron work during that, because it starts to run on each new file and it starts an infinite loop that the only way of stopping is to force restart.

I'm using Ubuntu server 18.04.6 on Orange Pi Pc.

I've tried a lot of different scripts and types of different sets of incron, but it never works the proper way.

Just ask if you need more information.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.