Linux?????????????
???????????? ???????[ 2015/6/5 11:25:46 ] ??????????????
???????? ??????????
???????????????????????????????test.c??????????init.c??????????????????/tmp??????е????test.log?????????????????????е?init_daemon???????????????????????????????init_daemon?????????????????????
????1?? init.c?嵥
#include < unistd.h >
#include < signal.h >
#include < sys/param.h >
#include < sys/types.h >
#include < sys/stat.h >
void init_daemon(void)
{
int pid;
int i;
if(pid=fork())
exit(0);//??????????????????
else if(pid< 0)
exit(1);//fork???????
//????????????????????
setsid();//???????????μ???鳤??????鳤
//?????????????
if(pid=fork())
exit(0);//??????????????????????
else if(pid< 0)
exit(1);//fork???????
//??????????????
//???????????????鳤
for(i=0;i< NOFILE;++i)//???????????д??????
close(i);
chdir("/tmp");//??乤??????е?/tmp
umask(0);//??????????????
return;
}
????2?? test.c?嵥
#include < stdio.h >
#include < time.h >
void init_daemon(void);//???????????????
main()
{
FILE *fp;
time_t t;
init_daemon();//??????Daemon
while(1)//??????????test.log?????????
{
sleep(60);//????????
if((fp=fopen("test.log"??"a")) >=0)
{
t=time(0);
fprintf(fp??"Im here at %s/n"??asctime(localtime(&t)) );
fclose(fp);
}
}
}
?????????????RedHat Linux6.0?±???????????????????£?
????????gcc -g -o test init.c test.c
??????У?./test
???????????ps -ef
????????????????test???????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Linux??????DDR????????????Linux?????????????????豸??????????linux???в???????????м??????????????????????????Linux????Linux??DNS????????????γ???????????Linux?????????????Linux????(???)????????Linux ????????????????????????????????Windows???У?Linux???????Linux????????????????Linux iommu??vfio???????Linux????ε???TCP???????Linux?????????????СLinux?·???????????Linux???Jexus?й?Asp.Net Core??ó???Linux?????????Щ??

???·???
App??С????H5?????????????????Щ??
2024/9/11 15:34:34?????????????????????????
2024/9/10 11:13:49P-One ???????????????????????????????????????
2024/9/10 10:14:12???????????????????????????
2024/9/9 18:04:26??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44