Skip to content

Commit

Permalink
linux shell
Browse files Browse the repository at this point in the history
  • Loading branch information
reymont committed May 29, 2019
1 parent fac5244 commit 4c0f0f7
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,14 @@ kubectl patch node k8s-node1 -p '{"spec":"{"unschedulable":"true"}"}'

kubectl cordon k8s-node1 #将k8s-node1节点设置为不可调度模式
kubectl drain k8s-node1 #将当前运行在k8s-node1节点上的容器驱离

kubectl uncordon k8s-node1 #执行完维护后,将节点重新加入调度

# 4. 更新资源对象的label
label作为用户可灵活定义的对象属性,在已创建的对象上仍然可以通过kubectl label命令对其进行增删改等操作

给一个node添加一个label
1. 给一个node添加一个label
kubectl label node k8s-node1 role=backend
删除label,只需要在命令行最后指定label的key名,并加一个减号即可:

2. 删除label,只需要在命令行最后指定label的key名,并加一个减号即可:
kubectl label node k8s-node1 role-

# 5. 将pod调度到指定的node
Expand Down
1 change: 1 addition & 0 deletions devops/06.kubernetes/10.开发指南/python/python.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
8. https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1ReplicationControllerSpec.md
1. https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1PodTemplateSpec.md
1. https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1PodSpec.md
1. node_selector dict(str, str)
2. https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1Volume.md
1. https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1HostPathVolumeSource.md
2. https://github.com/kubernetes-client/python/blob/master/kubernetes/docs/V1NFSVolumeSource.md
48 changes: 48 additions & 0 deletions linux/01.命令/shell/03.实现N位自动补零和日期循环.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
shell 实现N位自动补零和日期循环 - 京东放养的爬虫 - CSDN博客 https://blog.csdn.net/djd1234567/article/details/51570051
用awk的printf就可以补位




# 仅适用于数字

printf "%04d\n" 86

echo 86|awk '{printf("%04d\n",$0)}'




下面是我实际应用中使用的一个脚本,目的是批量修改hdfs上的文件名,输入两个参数即可,就是开始时间和结束时间,然后用whil去循环。


#example------nohup sh hdfs_rename.sh 20160522 20160530 >>logrename 2>&1 &

datebeg=$1
dateend=$2

beg_s=`date -d "$datebeg" +%Y%m%d`
end_s=`date -d "$dateend" +%Y%m%d`


while [ "$beg_s" -le "$end_s" ]
do
date=${beg_s}
for i in `seq 99`
do
num1=`echo ${i}|awk '{printf("%06d\n",$0)}'`
num2=`echo ${i}|awk '{printf("%02d\n",$0)}'`
echo ${date}
echo ${num1}
echo ${num2}
hadoop fs -mv /xtrader/${date}/${num1}_* /xtrader/${date}/xtrader_UserInfo_${date}_${num2}.gz
done
echo ${date}
beg_s=`date -d"${beg_s}+1 day" +%Y%m%d`

done
---------------------
作者:djd已经存在
来源:CSDN
原文:https://blog.csdn.net/djd1234567/article/details/51570051
版权声明:本文为博主原创文章,转载请附上博文链接!
4 changes: 4 additions & 0 deletions linux/01.命令/shell/04.for循环.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@


for i in `seq 1 100`; do echo $i ; done
for i in {1..100}; do echo $i ; done

0 comments on commit 4c0f0f7

Please sign in to comment.