Here’s the table of contents:
脚本内容
#!/usr/bin/env bash
################### config need to clean logs dir
BASEPATH=$(pwd)
CQLDIR=${BASEPATH}/cql/
echo logs absolute path:${CQLDIR}
################### get file name array
function getFileArray(){
cd ${CQLDIR}
j=0
for i in `ls`
do
folder_list[j]=${i}
j=`expr ${j} + 1`
done
}
################### get line array
function getFileLines(){
cd ${CQLDIR}
j=0
for i in `ls`
do
folder_list[j]=${i}
j=`expr ${j} + 1`
done
}
################### execute cql line
getFileArray;
for fileName in ${folder_list[@]}
do
suffix="cql"
if [[ ${fileName} == *$suffix ]]
then
echo cql file ... ${fileName}
# Get lines
cat ${fileName} | while read line
do
echo $line
nohup echo $line | /data/app/ongdb-enterprise-3.5.22/bin/cypher-shell -a bolt://localhost:7687 -u neo4j -p testlab%pro >>execute_cql.file 2>&1 &
done
else
echo ${fileName} "不是cql文件"
fi
done
################### background execution this shell
# START:
# ./execute_cql.sh
# STOP:
# kill -9 `ps -ef|grep execute_cql.sh|grep -v grep|awk '{print $2}'`
PREVIOUS定时清除日志Shell脚本
NEXT修改节点标签和关系类型