zeus之shell基本命令
2015-12-16 14:43
1456 查看
输出话术
echo "----------------------------------------"
执行hive命令
hive -e "。。"
定义变量
Year=`date +%Y`
echo 'Year='${Year}
month=`date +%m`
echo 'month='${month}
循环语句
for((i=0;i<100;i++)); do
{
}
done
并发执行,加&表示并发
for((i=0;i<100;i++)); do
{
} &
done
下载文件
download[hdfs:///zeus/uploaddir/XXX.properties-20151101-001.properties XXX.properties]
source XXX.properties
定义function,导入数据到mysql
function outputData() {
sh datax_run.sh \
-srcdb sourcedb -srctblnames tablename \
-querys "select uid,name from sourcedb.tablename where DatabaseName='${a}' and TableName='${b}';"\
-tarip ${Database}.mysql.db.com -tarport 44 -tardb ${Database} \
-tarusername ${CONNECTION_DB_USERNAME} -tarpasswd ${CONNECTION_DB_PASSWARD} \
-tartblnames ${tableName} \
-tarcolorders "uid,name" \
-mysqlmethodtype jdbc_replace \
-src hdfs -tar mysql
}
if语句
if [ ${i} -eq 10 ]; then
else
fi
发邮件
echo 'hello world' | mail -s "Subject" a@b.com
echo "----------------------------------------"
执行hive命令
hive -e "。。"
定义变量
Year=`date +%Y`
echo 'Year='${Year}
month=`date +%m`
echo 'month='${month}
循环语句
for((i=0;i<100;i++)); do
{
}
done
并发执行,加&表示并发
for((i=0;i<100;i++)); do
{
} &
done
下载文件
download[hdfs:///zeus/uploaddir/XXX.properties-20151101-001.properties XXX.properties]
source XXX.properties
定义function,导入数据到mysql
function outputData() {
sh datax_run.sh \
-srcdb sourcedb -srctblnames tablename \
-querys "select uid,name from sourcedb.tablename where DatabaseName='${a}' and TableName='${b}';"\
-tarip ${Database}.mysql.db.com -tarport 44 -tardb ${Database} \
-tarusername ${CONNECTION_DB_USERNAME} -tarpasswd ${CONNECTION_DB_PASSWARD} \
-tartblnames ${tableName} \
-tarcolorders "uid,name" \
-mysqlmethodtype jdbc_replace \
-src hdfs -tar mysql
}
if语句
if [ ${i} -eq 10 ]; then
else
fi
发邮件
echo 'hello world' | mail -s "Subject" a@b.com
相关文章推荐
- shell的foreach 函数
- bash下. : () {} [] [[]] (())的解释
- Shell脚本利用gnuplot绘制图片
- Linux Shell脚本实现根据进程名杀死进程
- 万能五笔输入法导致vs2013 xshell中文乱码
- shell中的exec命令
- shell 执行jar 的命令
- shell中 括号的作用
- shell脚本中select的应用
- Bash Shell:变量总结
- githup中shell命令的常见错误
- Linux基础8 bash的特性
- shell学习--控制结构
- linux shell 之sed命令
- 【随笔】Linux & Shell & Minecraft
- powershell 判断操作系统版本 命令
- xshell配色方案
- [转]adb shell dumpsys 命令
- 插入排序(直接插入排序和希尔(shell)排序
- 一次用bash+python分析NGINX日志的记录