Linux创建守护进程
来源:互联网 发布:检查网络用ping命令 编辑:程序博客网 时间:2024/05/19 12:24
#include <stdio.h>#include <unistd.h>#include <fcntl.h>#include <string.h>int main(int a,char *b[]){pid_t pid;pid = fork();printf("hahah");if(pid<0){ perror(""); _exit(1);}if(pid==0){ printf("this is a child process"); //set new session in a child process setsid(); //change current director into root director chdir("/"); //reset file permissions umask(0); //close opened file descriptor int i,fd_w; char buf[] = {"hello world \n"}; for(i=0;i<getdtablesize();i++) { close(i); } fd_w = open("/liupan_test.txt",O_CREAT | O_WRONLY | O_APPEND,0666); if(fd_w<0) { perror("");_exit(1); } while(1) { write(fd_w,buf,strlen(buf)); //close(fd_w); sleep(3); } }else { printf("this is a parent process"); _exit(0); }//return 0;}
0 0
- linux创建守护进程
- Linux 守护进程创建
- Linux创建守护进程
- linux创建守护进程
- Linux守护进程创建
- linux 创建守护进程
- Linux创建守护进程
- linux创建守护进程
- Linux 守护进程创建
- Linux 下创建守护进程
- linux c 创建守护进程
- linux守护进程及其创建
- linux守护进程及其创建
- linux守护进程的创建
- linux守护进程及其创建
- linux守护进程及其创建
- linux之创建守护进程
- Linux入门:创建守护进程
- sdn配置教程 ——从零开始搞sdn
- js中如何将字符串转换为数组
- 模拟客户端将数据flume存储在hdfs上
- 混合开发的大趋势之一React Native与Android联调
- pat-bl-1016
- Linux创建守护进程
- oracle 锁表、解锁的语句
- 创建群
- mysql.server详解
- Openstack_通用模块_Oslo_vmware 创建 vCenter 虚拟机快照
- (原创)Android6.0亮屏流程之Keyguard Window绘制
- spring中BeanNameAutoProxyCreator和AnnotationAwareAspectJAutoProxyCreator两种AOP代理方式使用总结
- 抓包工具双重代理
- 31.JS中的$