I want to sync an ftp directory with lftp
, and run a jar file afterwards, but only if any files have been changed.
For testing, I just tried to execute another bash file after sync has finished, but it does not work:
lftp.sh:
lftp -f "
open $HOST
user $USER $PASS
lcd $SOURCEFOLDER
mirror --delete --verbose --on-change=test.sh $SOURCEFOLDER $TARGETFOLDER
bye
"
test.sh:
echo test ok
Result:
Unknown command `test.sh'.
Why, and how can I improve this? Absolute path also fails!
If not possible, how can I catch some kind of status code on exit to determine if there was a change on sync, and execute a command in case?
As well it would be fine if I could just get the number of new files transfered.
Manuals for lftp realy states that:
But idea is that CMD is lftp command, not Bash. So to execute local script 'task.sh' we should use lftp expression like
source task.sh
or! task.sh
.