@@ -39,6 +39,12 @@ start()
39
39
exit 1
40
40
fi
41
41
42
+ start_smanager
43
+ if [ $? -ne 0 ]; then
44
+ docker-compose -f $builddir /docker-compose.yaml down
45
+ exit 1
46
+ fi
47
+
42
48
start_ipfs
43
49
if [ $? -ne 0 ]; then
44
50
docker-compose -f $builddir /docker-compose.yaml down
@@ -51,6 +57,7 @@ start()
51
57
stop ()
52
58
{
53
59
stop_chain
60
+ stop_smanager
54
61
stop_api
55
62
stop_sworker
56
63
stop_ipfs
@@ -89,6 +96,13 @@ logs()
89
96
return 0
90
97
fi
91
98
docker logs -f ipfs
99
+ elif [ x" $1 " == x" smanager" ]; then
100
+ check_docker_status crust-smanager
101
+ if [ $? -eq 1 ]; then
102
+ log_info " Service crust smanager is not started now"
103
+ return 0
104
+ fi
105
+ docker logs -f crust-smanager
92
106
elif [ x" $1 " == x" sworker-a" ]; then
93
107
check_docker_status crust-sworker-a
94
108
if [ $? -eq 1 ]; then
@@ -250,6 +264,34 @@ stop_api()
250
264
return 0
251
265
}
252
266
267
+ start_smanager ()
268
+ {
269
+ if [ -d " $builddir /smanager" ]; then
270
+ check_docker_status crust-smanager
271
+ if [ $? -ne 1 ]; then
272
+ return 0
273
+ fi
274
+
275
+ docker-compose -f $builddir /docker-compose.yaml up -d crust-smanager
276
+ if [ $? -ne 0 ]; then
277
+ log_err " [ERROR] Start crust-smanager failed"
278
+ return 1
279
+ fi
280
+ fi
281
+ return 0
282
+ }
283
+
284
+ stop_smanager ()
285
+ {
286
+ check_docker_status crust-smanager
287
+ if [ $? -ne 1 ]; then
288
+ log_info " Stopping crust smanager service"
289
+ docker stop crust-smanager & > /dev/null
290
+ docker rm crust-smanager & > /dev/null
291
+ fi
292
+ return 0
293
+ }
294
+
253
295
start_ipfs ()
254
296
{
255
297
if [ -d " $builddir /ipfs" ]; then
@@ -343,6 +385,21 @@ reload() {
343
385
return 0
344
386
fi
345
387
388
+ if [ x" $1 " = x" smanager" ]; then
389
+ log_info " Reload smanager service"
390
+
391
+ stop_smanager
392
+ $scriptdir /gen_config.sh
393
+ if [ $? -ne 0 ]; then
394
+ log_err " [ERROR] Generate configuration files failed"
395
+ exit 1
396
+ fi
397
+ start_smanager
398
+
399
+ log_success " Reload smanager service success"
400
+ return 0
401
+ fi
402
+
346
403
if [ x" $1 " = x" ipfs" ]; then
347
404
log_info " Reload ipfs service"
348
405
@@ -370,6 +427,8 @@ status()
370
427
api_status
371
428
elif [ x" $1 " == x" sworker" ]; then
372
429
sworker_status
430
+ elif [ x" $1 " == x" smanager" ]; then
431
+ smanager_status
373
432
elif [ x" $1 " == x" ipfs" ]; then
374
433
ipfs_status
375
434
elif [ x" $1 " == x" " ]; then
@@ -384,6 +443,7 @@ all_status()
384
443
local chain_status=" stop"
385
444
local api_status=" stop"
386
445
local sworker_status=" stop"
446
+ local smanager_status=" stop"
387
447
local ipfs_status=" stop"
388
448
389
449
check_docker_status crust
@@ -411,6 +471,14 @@ all_status()
411
471
sworker_status=" exited"
412
472
fi
413
473
474
+ check_docker_status crust-smanager
475
+ res=$?
476
+ if [ $res -eq 0 ]; then
477
+ smanager_status=" running"
478
+ elif [ $res -eq 2 ]; then
479
+ smanager_status=" exited"
480
+ fi
481
+
414
482
check_docker_status ipfs
415
483
res=$?
416
484
if [ $res -eq 0 ]; then
@@ -426,6 +494,7 @@ cat << EOF
426
494
chain ${chain_status}
427
495
api ${api_status}
428
496
sworker ${sworker_status}
497
+ smanager ${smanager_status}
429
498
ipfs ${ipfs_status}
430
499
-----------------------------------------
431
500
EOF
@@ -513,6 +582,27 @@ cat << EOF
513
582
EOF
514
583
}
515
584
585
+ smanager_status ()
586
+ {
587
+ local smanager_status=" stop"
588
+
589
+ check_docker_status crust-smanager
590
+ res=$?
591
+ if [ $res -eq 0 ]; then
592
+ smanager_status=" running"
593
+ elif [ $res -eq 2 ]; then
594
+ smanager_status=" exited"
595
+ fi
596
+
597
+ cat << EOF
598
+ -----------------------------------------
599
+ Service Status
600
+ -----------------------------------------
601
+ smanager ${smanager_status}
602
+ -----------------------------------------
603
+ EOF
604
+ }
605
+
516
606
ipfs_status ()
517
607
{
518
608
local ipfs_status=" stop"
@@ -538,26 +628,26 @@ help()
538
628
{
539
629
cat << EOF
540
630
Usage:
541
- help show help information
542
- start start all crust service
543
- stop stop all crust service
544
-
545
- status {chain|api|sworker|ipfs} check status or reload one service status
546
- reload {chain|api|sworker|ipfs} reload all service or reload one service
547
- logs {chain|api|sworker|ipfs} track service logs, ctrl-c to exit
548
- tools {...} use 'crust tools help' for more details
631
+ help show help information
632
+ start start all crust service
633
+ stop stop all crust service
634
+
635
+ status {chain|api|sworker|smanager| ipfs} check status or reload one service status
636
+ reload {chain|api|sworker|smanager| ipfs} reload all service or reload one service
637
+ logs {chain|api|sworker|smanager| ipfs} track service logs, ctrl-c to exit
638
+ tools {...} use 'crust tools help' for more details
549
639
EOF
550
640
}
551
641
552
642
tools_help ()
553
643
{
554
644
cat << EOF
555
645
crust tools usage:
556
- help show help information
557
- rotate-keys generate session key of chain node
558
- workload show workload information
559
- upgrade-reload {chain|api|ipfs|c-gen} upgrade one docker image and reload the service
560
- change-srd {number} change sworker's srd capacity(GB), for example: 'crust tools change-srd 100', 'crust tools change-srd -50'
646
+ help show help information
647
+ rotate-keys generate session key of chain node
648
+ workload show workload information
649
+ upgrade-reload {chain|api|smanager| ipfs|c-gen} upgrade one docker image and reload the service
650
+ change-srd {number} change sworker's srd capacity(GB), for example: 'crust tools change-srd 100', 'crust tools change-srd -50'
561
651
EOF
562
652
}
563
653
@@ -644,6 +734,12 @@ upgrade_reload()
644
734
return 1
645
735
fi
646
736
reload api
737
+ elif [ x" $1 " == x" smanager" ]; then
738
+ upgrade_docker_image crustio/crust-smanager
739
+ if [ $? -ne 0 ]; then
740
+ return 1
741
+ fi
742
+ reload smanager
647
743
elif [ x" $1 " == x" ipfs" ]; then
648
744
upgrade_docker_image ipfs/go-ipfs crustio/go-ipfs
649
745
if [ $? -ne 0 ]; then
0 commit comments