

#======================================================
# SCMS-SM VCS agents
# OnOnlyProcess agent - online
# Created: Aug 2004
#======================================================
# Developed to online the TimesTen Daemon
# based on the Process agent
#======================================================
# Modification list:
# 5/8/2004: created
#
#======================================================
# Messages Used:
# MSGID               Message
#------------------------------------------------------
# 37054: OnOnlyProcess:%s:online:Command length is greater than 78 characters.  This might pose potential monitoring problems
# 37055: OnOnlyProcess:%s:online: invalid online command '%s'
#======================================================

eval 'exec $VCS_HOME/bin/perl5 -S $0 ${1+"$@"}'
        if 0;
use ProcessOperations;

($ResID, $OnlineCmd) = @ARGV;

#
# Set the OS locale
#
$ENV{"LANG"}="C";
$vcs_home =$ENV{"VCS_HOME"} || "/opt/VRTSvcs";
my ( $log_message );


$OnlineCmd = cleanString($OnlineCmd);

use ag_i18n_inc;
VCSAG_SET_ENVS ("OnOnlyProcess", "online",$category_id);

if ($OnlineCmd eq "") {
   VCSAG_LOG_MSG("E","invalid online command '$OnlineCmd'",37055,"$OnlineCmd");
   exit 0;
}

system("$OnlineCmd &");
$Cmdlength = length($OnlineCmd);
#
# If the command + argument length happens to be greater than or equal to 78 
# characters we can have a problem.  Current implementations of the solaris ps 
# utility and proc file structures terminate the command + argument string
# at the 80 characters.  This could cause a problem if two process resources 
# had the same first 78 characters or more , i.e. say they had very long identical
# paths to execution and similar initial arguments. In such a case there is no
# way for the monitor script to know the true identity of the process being 
# executed.  Hence the warning message.
#
if ($Cmdlength >= 78){ 
   VCSAG_LOG_MSG("W","Command length is greater than 78 characters.  This might pose potential monitoring problems",37054);
}
exit 0;
