(07-12-2016 05:54 PM)YU_Xinjie Wrote: This thread is the design of service management of Sage
The usage of service management is in
http://tab.d-thinker.org/showthread.php?tid=6164
http://tab.d-thinker.org/showthread.php?tid=6197
Format PPM
./format.sh
Code:
dt format -n NVPC k
Load metadata
./load.sh
Code:
set $cfgfile, $nodefile, search file prefix($prefix).
echo 'Greppy system is starting.....'
tr '\n' from the $nodefile
function get_basic_info:
get vpcs,space,ip,slot,filename, nf(how many parts one line divided by space) info from $nodefile, all vars are array var.
function make_link:
parameter: $file need to search
if [ ! -f $file on $ip ] :
echo '$file not on $ip" and exit
else:
make links with $file into thinker stdin dir.
function gain_config() :
printf $space, $filesize, $dejavusize into $cfgfile
totalline = len of $nodefile
function gen_config()
mv vpc.$num and nrcs.$num to thinker runtime dir.
for i in range(0,totalline):
get_basic_info()
$host[i] = $ip
if [ $nf -eq 2 ] ##means file need to search
make_link
gain_config
else
print $space, 0, 0, 'n' to $cfgfile
gen_config()
call make datacfg to run size prog
call make read to run read prog
Start service
./start.sh
Code:
trap ctrl_c
if type ctrl_c; then
echo "You type ctrl_c to terminate program"
kill DT
clean all object files and exit
if the 1st parameter == 'nohup'; then
nohup do_start &
else
do_start
function do_start() {
make run
}
Stop service
./stop.sh
Show status
./status.h
Code:
dexer --ips=$ips "ps aux" | grep -E 'vpc|nrc|scheduler|mem_home|atpd|auntie|ncat' | grep 'sage' | grep -v 'dexer' | grep -v 'grep'
Saved a copy before change.