Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Service management of Sage - D
07-12-2016, 05:54 PM (This post was last modified: 11-23-2019 11:41 PM by lingu.)
Post: #1
Service management of Sage - D
The src of the sage program is cod://sage/src/service/bin/sage

goal

1. the script can be used on sage_user@sage_portal to start/stop/status sage.
2. the script should not couple GLAD.

The script would replace the current start.sh/stop.sh/status.sh.

sage main logiccommon var import
Code:
modname = sage
base=current dir
LearnPcf /thinker/etc/soft/$modname/mic.pcf
LearnPcf $base/config.pcf
ips=$base/hosts.ips
set timeout to be half of the number of lines in $ips or 3 if $ips does not exist

parse options
run command
  start
  status
  ps
  tasks
  help

sage start

Start a sage_screen to run script start_sage.
start_sage script looks like this:
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

do_start() {
    ./detect_listen.sh &
    make run, which would calls `dt run sage-svc $sage_base/config.pcf`
}

if the 1st parameter  == 'nohup'; then
    nohup do_start() > $sage_stdout 2>&1 &
else
    do_start() 2>&1

Use auntie/ps to check whether sage is started correctly.
If start successfully, wake_sage script is executed in a screen. wake_sage would periodically output the tasks graph info into $sage_base/stdout/tasks_graph.tmp.<timestamp>.

sage stop

Use 'dt slay' to stop DT.
Kill the sage_screen.
Use ps to check whether sage is stopped correctly.

sage status

"dexer auntie" to check the status of sage.

sage ps

Use "screen -ls" to get the sage_service screens info.
Use "dexer 'ps aux' | grep -E 'vpc|nrc|scheduler|mem_home|atpd|ncat|xfer|sgl|: ps aux'" to get the processes info.


sage tasks
sage tasks invokes function tasks_sage():
Code:
local tasks_graph_file=$base/stdout/tasks_graph.tmp
while True {
  while True {
    cnt = count ${tasks_graph_file}*;
    sleep 5 if cnt>1 || cnt==0;
    otherwise break;
  }
  call auntie ##To wake up sage to collect info in all nodes.
  check timestamp;
  cat $sage_base/stdout/tasks_graph.tmp.<timestamp>
  update timestamp;
}

---------
20191123/lingu: move tasks out.
20190511/cwt: Add auntie call.
20190510/lingu: timeout default 3.
20190509/cwt: Add common var import. Add timeout, IP count etc.
20190508/lingu: add src location.
20160927/yxj: decouple sage service script with glad.
Quote this message in a reply
Post Reply 


Messages In This Thread
Service management of Sage - D - YU_Xinjie - 07-12-2016 05:54 PM
RE: Service management of Sage - YU_Xinjie - 09-07-2016, 02:00 PM
RE: Service management of Sage - YU_Xinjie - 09-07-2016, 02:47 PM
RE: Service management of Sage - lingu - 09-07-2016, 03:53 PM
RE: Service management of Sage - YU_Xinjie - 09-07-2016, 04:11 PM
RE: Service management of Sage - lingu - 09-07-2016, 05:06 PM
RE: Service management of Sage - YU_Xinjie - 09-07-2016, 05:18 PM
RE: Service management of Sage - lingu - 09-07-2016, 03:55 PM
RE: Service management of Sage - lingu - 09-07-2016, 03:58 PM
RE: Service management of Sage - lingu - 09-07-2016, 05:35 PM
RE: Service management of Sage - YU_Xinjie - 09-07-2016, 05:53 PM
RE: Service management of Sage - lingu - 09-07-2016, 06:18 PM
RE: Service management of Sage - YU_Xinjie - 09-07-2016, 06:37 PM
RE: Service management of Sage - lingu - 09-07-2016, 06:53 PM
RE: Service management of Sage - YU_Xinjie - 09-08-2016, 04:28 PM
RE: Service management of Sage - lingu - 09-15-2016, 12:49 AM
RE: Service management of Sage - lingu - 09-07-2016, 06:52 PM
RE: Service management of Sage - YU_Xinjie - 09-08-2016, 04:48 PM
RE: Service management of Sage - lingu - 09-15-2016, 12:34 AM
RE: Service management of Sage - YU_Xinjie - 09-18-2016, 03:59 PM
RE: Service management of Sage - lingu - 09-23-2016, 10:41 PM
RE: Service management of Sage - YU_Xinjie - 09-27-2016, 11:33 AM
RE: Service management of Sage - lingu - 09-27-2016, 12:35 PM
RE: Service management of Sage - YU_Xinjie - 09-08-2016, 06:41 PM
RE: Service management of Sage - YU_Xinjie - 09-27-2016, 05:16 PM
RE: Service management of Sage - YU_Xinjie - 09-27-2016, 05:34 PM
RE: Service management of Sage - OMUD - YU_Xinjie - 10-19-2016, 06:37 PM
RE: Service management of Sage - OMUD - YU_Xinjie - 12-06-2016, 12:32 PM
RE: Service management of Sage - OMUD - YU_Xinjie - 12-06-2016, 03:32 PM
RE: Service management of Sage - OMUD - YU_Xinjie - 01-12-2017, 07:05 PM
RE: Service management of Sage - OD - YU_Xinjie - 06-02-2017, 06:24 PM
RE: Service management of Sage - D - lingu - 05-08-2019, 09:55 PM
RE: Service management of Sage - D - lingu - 05-08-2019, 10:01 PM
RE: Service management of Sage - D - xwcwt - 05-09-2019, 10:37 AM
RE: Service management of Sage - D - lingu - 05-09-2019, 06:39 PM
RE: Service management of Sage - D - lingu - 05-09-2019, 06:42 PM
RE: Service management of Sage - D - lingu - 05-09-2019, 06:52 PM
RE: Service management of Sage - D - lingu - 05-09-2019, 07:09 PM
RE: Service management of Sage - D - xwcwt - 05-09-2019, 07:12 PM
RE: Service management of Sage - D - lingu - 05-10-2019, 07:41 PM
RE: Service management of Sage - D - lingu - 05-10-2019, 07:46 PM
RE: Service management of Sage - D - xwcwt - 05-11-2019, 10:14 AM
RE: Service management of Sage - D - lingu - 05-10-2019, 07:56 PM
RE: Service management of Sage - D - lingu - 11-23-2019, 11:48 PM
RE: Service management of Sage - D - zheny - 11-24-2019, 06:09 PM
RE: Service management of Sage - D - xwcwt - 11-25-2019, 03:17 PM
RE: Service management of Sage - D - lingu - 11-23-2019, 11:30 PM

Forum Jump: