samedi 23 mars 2019

Check if pid is running in Linux freebsd

Hello guys my problem is the code works perfectly but not my solution. I will the command without output.

Add the /dev/null 2>&1 tag and more but then works the function not

The compile code

bool CheckServerRunning(const string &link) {
    return (system(("ps -ef | grep `cat " + link + "pid` /dev/null 2>&1").c_str()));
}

bool IsServerRunning() {
    if (CheckServerRunning("/usr/home/game2/channel1/core1/")) {
        cout << "True";
    }
    else {
        cout << "False";
    }
}

Aucun commentaire:

Enregistrer un commentaire