进程间通信之文件

以时间/日期服务器为例来说明进程间的通信

这里用shell脚本来实现

1,服务程序, 更新当前时间到一个文件,
#! /bin/sh
# time server
    while true;do
    date > /temp/current_date
    sleep 1
done
 
2,客户程序,通过共享文件获得当前时间进程。
#! /bin/sh
#time client
 
cat /tmp/current-date

 

进程间通过文件进行通信示意图

原文地址:https://www.cnblogs.com/songyuejie/p/4015787.html