php 执行 shell 命令 更新 mysql 到 es
2016-08-04 15:54
609 查看
#!/bin/sh
# DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# bin=${DIR}/../bin
# lib=${DIR}/../lib
bin=$JDBC_IMPORTER_HOME/bin
lib=$JDBC_IMPORTER_HOME/lib
# echo $lib
num=$1
echo '
{
"type" : "jdbc",
"jdbc" : {
"url" : "jdbc:mysql://127.0.0.1:3306/adbug",
"user" : "root",
"password" : "",
"sql" : [ {
"statement" : "select *,id as _id from users where id>?",
"parameter" : '${num}'
} ],
"index" : "users",
"type" : "user_index",
"index_settings" : {
"index" : {
"number_of_shards" : 1
}
}
}
}
' | java \
-cp "${lib}/*" \
-Dlog4j.configurationFile=${bin}/log4j2.xml \
org.xbib.tools.Runner \
org.xbib.tools.JDBCImporter
# DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# bin=${DIR}/../bin
# lib=${DIR}/../lib
bin=$JDBC_IMPORTER_HOME/bin
lib=$JDBC_IMPORTER_HOME/lib
# echo $lib
num=$1
echo '
{
"type" : "jdbc",
"jdbc" : {
"url" : "jdbc:mysql://127.0.0.1:3306/adbug",
"user" : "root",
"password" : "",
"sql" : [ {
"statement" : "select *,id as _id from users where id>?",
"parameter" : '${num}'
} ],
"index" : "users",
"type" : "user_index",
"index_settings" : {
"index" : {
"number_of_shards" : 1
}
}
}
}
' | java \
-cp "${lib}/*" \
-Dlog4j.configurationFile=${bin}/log4j2.xml \
org.xbib.tools.Runner \
org.xbib.tools.JDBCImporter
相关文章推荐
- MySQL更新字段中部分内容&shell脚本执行命令
- 在mysql中执行shell命令
- mysql环境下执行shell命令
- shell 下执行mysql 命令
- php执行shell命令,system、exec、passthru
- php -- PHP在linux上执行外部命令,system(),exec(),shell_exec()
- shell 下执行mysql 命令
- paip.执行shell cmd 命令uapi java php python总结
- shell 下执行mysql 命令
- 在PHP中执行shell命令
- Magento使用php shell 命令更新索引(index)
- mysql中执行shell命令
- paip.执行shell cmd 命令uapi java php python总结
- php执行外部命令函数:exec()、passthru()、system()、shell_exec()对比
- php+mysqli实现批量执行插入、更新及删除数据的方法
- 用PHP执行shell命令
- shell中执行mysql命令
- PHP执行系统外部命令函数:exec()、passthru()、system()、shell_exec()
- php 执行shell命令的函数
- shell 下执行mysql 命令