medcl / esm

An simple Elasticsearch migration tool.
866 stars 261 forks source link

无法在后台执行,必须要在终端下面跑。 #14

Closed lkad closed 6 years ago

lkad commented 6 years ago

每次跑得时候必须在终端下才能正常运行,如果在后台运行,则报错:

panic: Can't get terminal settings: inappropriate ioctl for device

goroutine 1 [running]: main.main() /Users/medcl/BTSync/github/elasticsearch-migration/main.go:174 +0x4b7b panic: Can't get terminal settings: inappropriate ioctl for device

goroutine 1 [running]: main.main() /Users/medcl/BTSync/github/elasticsearch-migration/main.go:174 +0x4b7b 重现方法: myshell script: for i in $datelist;do for x in curl -s ${es1}/_cat/indices | awk '{print $3}' | grep ${i};do /opt/bin/linux64/esm -s ${es1} -d ${es2} -w 5 -b 40 -c 10000 -x $x -f --copy_mappings >/dev/null if [ "$?" -eq 0 ]; then es1_doc_num=curl -s ${es1}/_cat/indices/$x | awk '{print $(NF-3)}' es2_doc_num=curl -s ${es2}/_cat/indices/$x | awk '{print $(NF-3)}' doc_diff=expr ${es1_doc_num} - ${es2_doc_num} echo "$x is migrationed done, the ${x}_doc_diff is $doc_diff " else echo "$x is migrated err" fi done done 这个脚本运行时候加 & 在后台跑就会报错,在crontab 里面跑也会报错。 谢谢。

medcl commented 6 years ago

恩,这个看来是个问题,当前依赖了一个终端显示进度条的依赖,所以应该这个是引起后台无法运行的问题,关联:https://github.com/medcl/esm/issues/10

medcl commented 6 years ago

看来是时候重写这个工具了

lkad commented 6 years ago

Thank you for your attention。

auzn1025 commented 4 years ago

@medcl 这个工具后台nohup执行的重写,啥时候更新哦。现在依赖终端,要手工执行,不能量产哦。

medcl commented 4 years ago

@auzn1025 新的0.4.4_SNAPSHOT已经支持了,试一下看看。