It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center
                            
                        
                    
                
                                6年前关闭。
            
                    
我所拥有的是一个C程序和一个Shell脚本。 c程序实现了inotify库,该程序监视目录并将目录中新生成的文件写入文件。然后,shell脚本以c程序生成的文件为输入,将这些文件rsync到远程目录。我如何在C程序和Shell脚本之间进行同步?

最佳答案

假设C程序将目录中新生成的文件写入名为“ LIST.txt”的文件。

mv LIST.txt LIST_TO_SYNC.txt && :> LIST.txt
rsync --include-from=LIST_TO_SYNC.txt #add your real parameters
mv LIST_TO_SYNC.txt LIST.txt.`date +%Y%m%d_%H%M%S`

关于c - Shellscript和C程序之间的同步,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/15738433/

10-17 03:07