@@ -50,7 +50,7 @@ def init_dir(server, client, key, path, link_path=None):
5050 ret = client .execute_command ('mkdir -p %s' % path )
5151 if ret :
5252 if link_path :
53- client .execute_command ("if [ '%s' -ef '%s' ]; then ln -sf %s %s; fi" % (path , link_path , path , link_path ))
53+ client .execute_command ("if [ ! '%s' -ef '%s' ]; then ln -sf %s %s; fi" % (path , link_path , path , link_path ))
5454 return True
5555 else :
5656 critical ('fail to initialize %s %s path: %s permission denied' % (server , key , ret .stderr ))
@@ -124,7 +124,7 @@ def init(plugin_context, *args, **kwargs):
124124 ret = client .execute_command ('mkdir -p %s/sstable' % data_path )
125125 if ret :
126126 link_path = '%s/store' % home_path
127- client .execute_command ("if [ '%s' -ef '%s' ]; then ln -sf %s %s; fi" % (path , link_path , path , link_path ))
127+ client .execute_command ("if [ ! '%s' -ef '%s' ]; then ln -sf %s %s; fi" % (data_path , link_path , data_path , link_path ))
128128 for key in ['clog' , 'ilog' , 'slog' ]:
129129 # init_dir(server, client, key, server_config['%s_dir' % key], os.path.join(data_path, key))
130130 log_dir = server_config ['%s_dir' % key ]
@@ -144,7 +144,7 @@ def init(plugin_context, *args, **kwargs):
144144 ret = client .execute_command ('mkdir -p %s' % log_dir )
145145 if ret :
146146 link_path = '%s/%s' % (data_path , key )
147- client .execute_command ("if [ '%s' -ef '%s' ]; then ln -sf %s %s; fi" % (path , link_path , path , link_path ))
147+ client .execute_command ("if [ ! '%s' -ef '%s' ]; then ln -sf %s %s; fi" % (log_dir , link_path , log_dir , link_path ))
148148 else :
149149 critical ('failed to initialize %s %s dir' % (server , key ))
150150 else :
0 commit comments