コード例 #1
0
static int
printrestart(const char *cell, const char *host,
	     int noauth, int localauth, int verbose)
{
    struct rx_connection *conn;
    struct bozo_netKTime time;
    int error;
    
    conn = arlalib_getconnbyname(cell,
				 host,
				 afsbosport,
				 BOS_SERVICE_ID,
				 arlalib_getauthflag(noauth, localauth,0,0));
    
    if (conn == NULL) {
	printf ("bos restart: failed to open connection to %s\n", host);
	return 0;
    }
    
    error = BOZO_GetRestartTime(conn, BOZO_RESTARTTIME_GENERAL, &time);
    if (error) {
	printf("bos: GetRestartTime(GENERAL) failed with: %s (%d)\n",
	       koerr_gettext(error), error);
	return 0;
    }
    printf ("Server %s restarts at %02d:%02d:%02d at day %d\n",
	    host, time.hour, time.min, time.sec, time.day);

    error = BOZO_GetRestartTime(conn, BOZO_RESTARTTIME_NEWBIN, &time);
    if (error) {
	printf("bos: GetRestartTime(NEWBIN) failed with: %s (%d)\n",
	       koerr_gettext(error), error);
	return 0;
    }
    printf ("Server %s restarts for new binaries at %02d:%02d:%02d at day %d\n",
	    host, time.hour, time.min, time.sec, time.day);
    
    arlalib_destroyconn(conn);
    return 0;
}
コード例 #2
0
static int
stop(const char *cell, const char *host, const char *instance,
	int noauth, int localauth, int verbose)
{
    struct rx_connection *conn = NULL;
    int error;

    conn = arlalib_getconnbyname(cell,
				 host,
				 afsbosport,
				 BOS_SERVICE_ID,
				 arlalib_getauthflag(noauth, localauth,0,0));
    if (conn == NULL)
	return -1;
    
    error = BOZO_SetTStatus(conn, instance, BSTAT_SHUTDOWN);
    switch (error) {
    case BZACCESS:
	printf ("bos stop: You are not allowed to stop the instance"
		" %s on server %s\n", instance, host);
	break;
    case BZNOENT:
	printf ("bos stop: the instance %s does not exsist on server %s\n"
		, instance, host);
	break;
    case 0:
	printf ("bos stop: Instance %s stopped on server %s\n", instance, host);
	break;
    default:
	printf("bos stop: GetStat failed with: %s (%d)\n",
	       koerr_gettext(error), error);
	break;
    }
  
    arlalib_destroyconn(conn);
    return 0;
}