创建用户实例
- 新建一个用户
#-d与-m作用 给winn账户创建一个主目录
[root@iZ2zegctspnn963lglh798Z ~]# useradd -d /usr/winn -m winn
#重置密码
[root@iZ2zegctspnn963lglh798Z usr]# cd /usr/winnx/
[root@iZ2zegctspnn963lglh798Z winnx]# passwd winn
Changing password for user winn.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.
- 赋予sudo权限
#修改文件
[root@iZ2zegctspnn963lglh798Z winnx]# vim /etc/sudoers
#添加下面内容
winn ALL=(ALL) ALL
#强制保存
:wq!
自动化发布脚本示例
echo "===========进入git项目happymmall目录============="
cd /developer/git-repository/mmall
echo "==========git切换分之到mmall-v1.0==============="
git checkout mmall-v1.0
echo "==================git fetch======================"
git fetch
echo "==================git pull======================"
git pull
echo "===========编译并跳过单元测试===================="
mvn clean package -Dmaven.test.skip=true
echo "============删除旧的ROOT.war==================="
rm /developer/apache-tomcat-7.0.73/webapps/ROOT.war
echo "======拷贝编译出来的war包到tomcat下-ROOT.war======="
cp /developer/git-repository/mmall/target/mmall.war /developer/apache-tomcat-7.0.73/webapps/ROOT.war
echo "============删除tomcat下旧的ROOT文件夹============="
rm -rf /developer/apache-tomcat-7.0.73/webapps/ROOT
echo "====================关闭tomcat====================="
/developer/apache-tomcat-7.0.73/bin/shutdown.sh
echo "================sleep 10s========================="
for i in {1..10}
do
echo $i"s"
sleep 1s
done
echo "====================启动tomcat====================="
/developer/apache-tomcat-7.0.73/bin/startup.sh