创建过程中独立的bash [英] create process independent of bash

查看:95
本文介绍了创建过程中独立的bash的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经写了一个程序,计算我的笔记本电脑电池提供量水平。我还定义在程序的阈值。当电池电量低于阈值的我想打电话给另一个进程。我已经使用系统(./ invoke.o),其中invoke.o是,我有运行程序。我运行它运行时间为5秒,电池电量检查程序的脚本。一切正常,但是当我关闭的bash shell invoke.o自动调用没有发生。我应该怎么做可以不管的bash是否关闭或不调用invoke.o ??。我使用的Ubuntu Linux操作系统

I have written a program which calculates the amount of battery level available in my laptop. I have also defined a threshold value in the program. Whenever the battery level falls below threshold i would like to call another process. I have used system("./invoke.o") where invoke.o is the program that i have to run. I am running a script which runs the battery level checker program for every 5 seconds. Everything is working fine but when i close the bash shell the automatic invocation of invoke.o is not happening. How should i make the invoke.o to be invoked irrespective of whether bash is closed or not??. I am using UBUNTU LINUX

推荐答案

尝试运行它为: nohup的./myscript.sh ,其中 nohup的命令允许你关闭shell而不终止的过程。

Try running it as: nohup ./myscript.sh, where the nohup command allows you to close the shell without terminating the process.

这篇关于创建过程中独立的bash的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆