@@ -622,33 +622,36 @@ def can_update(self):
622
622
623
623
def start (self ):
624
624
if self .__slot_id is None :
625
- return self .ssh_command ("sudo start kikimr" )
626
- return self .ssh_command (
627
- [
628
- "sudo" , "start" ,
629
- "kikimr-multi" ,
630
- "slot={}" .format (self .__slot_id ),
631
- "tenant=/Root/db1" ,
632
- "mbus={}" .format (self .__mbus_port ),
633
- "grpc={}" .format (self .__grpc_port ),
634
- "mon={}" .format (self .__mon_port ),
635
- "ic={}" .format (self .__ic_port ),
636
- ]
625
+ return self .ssh_command ("sudo service kikimr start" )
626
+
627
+ slot_dir = "/Berkanavt/kikimr_{slot}" .format (slot = self .__slot_id )
628
+ slot_cfg = slot_dir + "/slot_cfg"
629
+ env_txt = slot_dir + "/env.txt"
630
+
631
+ cfg = """\
632
+ tenant=/Root/db1
633
+ grpc={grpc}
634
+ mbus={mbus}
635
+ ic={ic}
636
+ mon={mon}""" .format (
637
+ mbus = self .__mbus_port ,
638
+ grpc = self .__grpc_port ,
639
+ mon = self .__mon_port ,
640
+ ic = self .__ic_port ,
637
641
)
638
642
643
+ self .ssh_command (["sudo" , "mkdir" , slot_dir ])
644
+ self .ssh_command (["sudo" , "touch" , env_txt ])
645
+ self .ssh_command (["/bin/echo" , "-e" , "\" {}\" " .format (cfg ), "|" , "sudo" , "tee" , slot_cfg ])
646
+
647
+ return self .ssh_command (["sudo" , "systemctl" , "start" , "kikimr-multi@{}" .format (self .__slot_id )])
648
+
639
649
def stop (self ):
640
650
if self .__slot_id is None :
641
- return self .ssh_command ("sudo stop kikimr" )
651
+ return self .ssh_command ("sudo service kikimr stop " )
642
652
return self .ssh_command (
643
653
[
644
- "sudo" , "stop" ,
645
- "kikimr-multi" ,
646
- "slot={}" .format (self .__slot_id ),
647
- "tenant=/Root/db1" ,
648
- "mbus={}" .format (self .__mbus_port ),
649
- "grpc={}" .format (self .__grpc_port ),
650
- "mon={}" .format (self .__mon_port ),
651
- "ic={}" .format (self .__ic_port ),
654
+ "sudo" , "systemctl" , "start" , "kikimr-multi@{}" .format (self .__slot_id ),
652
655
]
653
656
)
654
657
0 commit comments