Tag: petalinux

触发服务从服务本身重新启动

我开发了一个应用程序mysvc ,它通过/etc/init.d/mysvc-service作为(Peta)Linux服务运行(名称应该不同,因为它们在petalinux / yocto词汇表中是不同的“应用程序”)。 /usr/bin/mysvc通过start-stop-daemon : # start() start-stop-daemon -S -o –background -x /usr/bin/mysvc # stop() start-stop-daemon -K -x /usr/bin/mysvc 它嵌入了一个简单的HTTP服务器,允许盒重启/关闭(工作),我想添加一个只运行/etc/init.d/mysvc-service restart的Restart按钮(从命令行运行正常)。 当我想从程序本身使用Linux /etc/init.d/系统(构建命令行参数等)时,我检查了另一个重新运行程序本身的问题 (即响应HTTP请求)由我的服务器处理)所以我尝试了以下方法: daemon() 将调用daemon()基本上fork()和exit()父进程。 子进程实际上只是运行/etc/init.d/mysvc-service start : if (daemon(1,1) == 0) { // Forks and exit() the parent. We are the child system(“/etc/init.d/mysvc-service start”); // “start” and not “restart” because the parent […]