标签:
void catch_Signal(int Sign)
{
switch(Sign)
{
case SIGTERM:
exit(EXIT_SUCCESS);
}
}
#!/bin/sh
WHOAMI=`whoami`
PID=`ps -u $WHOAMI | grep abc | awk ‘{print $1}‘`
if (test "$PID" != "") then
kill $PID
fi
读FIFO void readfifo() { int len = 0; char buf[1024]; memset(buf, 0, sizeof(buf)); int fd = open("/home/test/1/fifo1", O_RDONLY); while ((len = read(fd, buf, sizeof(buf))) > 0) { printf("%s\n", buf); } close(fd); return; }
写FIFO void writefifo() { int len = 0; char buf[1024]; memset(buf, 0, sizeof(buf)); int fd = open("/home/test/1/fifo1", O_WRONLY); scanf("%s", buf); write(fd, buf, sizeof(buf)); close(fd); return; }
标签:
原文地址:http://www.cnblogs.com/shichuan/p/4496189.html