2 Replies Latest reply on Oct 18, 2007 10:24 AM by Jean AGULLO

    Restarting agent on Unix

    Jean AGULLO

      I try to allow somebody (no root) to restart BladeLogic agent.

       

      That’s what I do, below:

       

      1. vi testagent.c

      ====================================

      #include <stdio.h>

      #include <stdlib.h>

      #include <sys/types.h>

      #include <unistd.h>

       

      int main()

      {

      uid_t uid = geteuid ();

      gid_t gid = getegid ();

      printf ("uid=%d gid=%d\n", (int) uid, (int) gid);

      system("/exec/products/sbin/agentctl restart");

      }

      ====================================

       

      1. gcc –o restartagent testagent.c

       

      1. chmod +s restartagent

      2. ls –l restartagent

      -rwsr-sr-x 1 root root 101206 Oct 09 16:00 relanceagent

       

      When I run « restartagent » It’s OK on AIX and HP-UX but it doesn’t work on Linux or Solaris.

       

      Thanks in advance