if [ `pstree | grep -o "progname" | head -n 1` = "progname" ]; then echo "program is running" else echo "program is not running" fi
I have tried to translate this to "C"
if (system("pstree | grep -o progname | head -n 1") == "progname"); {
/* program is running */
/* do something here if program is running */
} else {
/* program is not running */
/* do something here if program is not running */
}
The code in "C" does nothing at all, maybe I have something wrong here, there are no error massages or anything.
Maybe there is another way to achieve this in "C"
thanks
The "C" code was an example
here is what I used in my program.
if (system("pstree | grep -o "progname" | head -n 1") == "progname"); {
/* program is running */
gtk_label_set_text(GTK_LABEL (label_status), gettext("Streaming Status: Streaming"));
} else {
/* program is not running */
gtk_label_set_text(GTK_LABEL (label_status), gettext("Streaming Status: Stopped"));
}

New Topic/Question
Reply



MultiQuote






|