int ls_limcontrol (char *hostname, int opCode)
ls_limcontrol()has the following parameters:
where opCode describes the ls_limcontrol()operation. To shut down a host’s LIM, choose the following operation code:
The following code example demonstrates how to shut down a host’s LIM using ls_limcontrol():
/******************************************************* LSLIB -- Examples** ls_limcontrol()* Shuts down or reboots a host’s LIM.******************************************************/#include <lsf/lsf.h>#include <io.h>#include <stdlib.h>#include <stdio.h>int main(int argc, char ** argv){int result; /* returned value from ls_limcontrol*/int opCode; /*option*/char* host; /*host*//* Checking for the correct format */if (argc !=2){fprintf(stderr, "usage: sudo %s <host>\n", argv[0]);exit(-1);}host = argv[1];/* To shut down a host, assign LIM_CMD_SHUTDOWN to the opCode */opCode = LIM_CMD_SHUTDOWN;printf("Shutting down LIM on host <%s>\n", host);result =ls_limcontrol(host, opCode);/* If there is an Error in execution, the program exits */if (result == -1){ls_perror("ls_limcontrol");exit(-1);}/* Otherwise, indicate successful program execution */else{printf("host <%s> shutdown successful.\n", host);exit (0);}
To use the above example, at the command line type:
where hostname is the name of the host you want to move to another cluster.