## Centos / ## #!/bin/sh file="$1" remotedir="$2" filename=$(|awk -F '/' '{print $NF}') . /etc/init.d/functions ] then echo "You must have two argument." echo "USAGE:/bin/sh $0 arg1 arg2" exit fi for ip in `cat ipli
centos shell脚本编程2 if 判断 case判断 shell脚本中的循环 for while shell中的函数 break continue test 命令 第三十六节课 return用在函数中exit用在shell当中 直接退出整个脚本,整个子shell或当前shellbreak退出循环 上半节课 if 判断case判断shell脚本中的循环 下半节课 for whileshell中的函数breakcontinue 课程大纲(继续上节课的) 7. if
1.ssh免密登录 ssh ip地址 [root@192 ~]# ssh 192.168.1.102 root@192.168.1.102's password: Last login: Mon Feb 18 20:40:28 2019 from 192.168.1.101 免密登录配置 生成公钥和私钥 [root@192 ~]# ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to sa
centos初始化脚本 添加IP.主机名.挂载/dev/sdb1磁盘 #!/bin/bash # ip=$ hostname=$ if [ -z $ip ] || [ -z $hostname ]; then echo " " echo "Sorry, IP or host is null" echo "# The format : bash set.sh ip hostname" echo "# For example: bash s
sftp用户创建,改变属组,家目录 #!/bin/python import os,sys class sftp_user(object): def __init__(self,user,passwd): self.user = user self.passwd = passwd # 改变用户的属组 def user_mod(self): for i in self.user: data = os.popen("usermod -g sftp %s"%i).read() print(d