cre_index.sh
curl -XPUT 0.0.0.0:9200/gather-027-20170228
curl -XPUT 0.0.0.0:9200/gather-027-20170227
curl -XPUT 0.0.0.0:9200/gather-027-20170226
curl -XPUT 0.0.0.0:9200/gather-027-20170225
curl -XPUT 0.0.0.0:9200/gather-027-20170224
curl -XPUT 0.0.0.0:9200/gather-027-20170223
curl -XPUT 0.0.0.0:9200/gather-027-20170222
curl -XPUT 0.0.0.0:9200/gather-027-20170221
curl -XPUT 0.0.0.0:9200/gather-027-20170220
curl -XPUT 0.0.0.0:9200/gather-027-20170219
curl -XPUT 0.0.0.0:9200/gather-027-20170218
shell.py
import os
class Shell(object):
def __init__(self,sh_path,host,port,index_pre,index_date,time_size,keep_count):
self.shell = str(sh_path)
self.host = str(host)
self.port = str(port)
self.index_pre = str(index_pre)
self.index_date = str(index_date)
self.time_size = str(time_size)
self.keep_count = str(keep_count)
def run_background(self):
cmd_list=[]
cmd_list.append(self.shell)
cmd_list.append(self.host)
cmd_list.append(self.port)
cmd_list.append(self.index_pre)
cmd_list.append(self.index_date)
cmd_list.append(self.time_size)
cmd_list.append(self.keep_count)
pos = self.shell.rfind('/')+1
#print(pos)
#print(len(self.shell))
sh_file = self.shell[pos:]
exe = 'chmod +x '+sh_file
#print(exe)
os.system(exe)
cmd = ' '.join(cmd_list)
#print("cmd=&