Why Ubuntu 16.04 C++ program cannot programatically stop mono-service?

Frank Chang frankchang91 at gmail.com
Tue May 17 05:45:02 UTC 2016


When I run at the Ubuntu Linux 16.04 command  line:

   pkill -f mono-service.exe

it sucessfully works because I observe in /var/log/syslog , "Stopping
service .......".


  But when I run this C++ program, it is unable to stop the service.

int main(int argc, char* argvp)
{
    char *argv[] = {"pkill", "-f", "'mono-service.exe'",0};

    char *envp[] =
    {
        "LD_LIBRARY_PATH=.",
        0
    };
    execve(argv[0], &argv[0],  envp);
    fprintf(stderr, "Oops!\n");
    return -1;

}

Please tell me how I fix this program so I can stop mono-service
programatically in a C++ program.

Any help is greatly appreciated.

Thank you.
       Frank
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/ubuntu-users/attachments/20160517/622904c6/attachment.html>


More information about the ubuntu-users mailing list