23,124
社区成员
发帖
与我相关
我的任务
分享
#include <unistd.h>
int main(void)
{
pid_t pid = fork();
if (pid!=0){
int st;
wait(&st);
exit(0);
}
pid = fork();
if (pid != 0){
exit(0);
}
sleep(3600);
system("shutdown -h now");
return 0;
}
后台版的
int main(void)
{
sleep(3600);
system("shutdown -h now");
return 0;
}
以root身份运行