快速配置ssh互信

添加互信

安装 expect

sudo apt-get install tcl tk expect

创建脚本和主机列表文件,所有服务器密码需一样,根据实际环境,需要更改脚本里的密码

cat << EOF > ~/auto_ssh.exp

! /usr/bin/expect

执行ssh-keygen命令,如果需要就解注释

spawn ssh-keygen
expect “id_rsa”
send “\r”
expect “phrase”
send “\r”
expect “again”
send “\r”
interact

set f [open auto_ssh_host_ip r]
while { [gets $f ip]>=0} {
spawn ssh-copy-id $ip
expect {
yes/no” {send “yes\r”;exp_continue} “password:” {send “123123\r”;exp_continue}
}
}
close $f
EOF

创建主机列表文件

cat << EOF > ~/auto_ssh_host_ip
server-31
server-32
server-33
EOF

执行脚本

 expect ~/auto_ssh.exp

HOW TO: Find the ulimit value picked up by a running Informatica process on AIX platform

There are multiple ways to find the ulimit value picked up by a process on AIX platform.

  1. For Informatica processes with java and non java executable, (For example pmserver, pmrepagent)
    • Find the process id
    • Attach to process to dbx
      • dbx -a PID
    • Collect the limit information
      • proc rlimit > proc_limit.out
    • Detach process from dbx
      • detach
  2. If the Informatica process is a java process then you can generate a javacore of the process which contains the ulimit details as well. The following KB can be followed to get the ulimit information of the java process. (HOW TO: Conclusively determine user limits (ulimit) set on an AIX Java process like an Informatica node process in PowerCenter (156083))
  3. Also a command task can be used to run the command “ulimit -a”. This gives information about the ulimit values picked by the Informatica processes.

mysql 恢复忘记root密码脚本-centos

#!/bin/bash
newpassword=$1
if [ “$newpassword” == “” ];then
echo “password is emty. please use ./mysql_password_recovery.sh yourpassword”
exit
fi
echo ” Stopping mysql…”
systemctl stop mysqld
echo ” Setting the mySQL environment option..”
systemctl set-environment MYSQLD_OPTS=”–skip-grant-tables”
echo “Startng mysql ignoring password verification..”
systemctl start mysqld
echo “Updating the root user password with your provided password”
# mysql -u root
echo “UPDATE mysql.user SET authentication_string = PASSWORD(‘$newpassword’) WHERE User = ‘root’ AND Host = ‘localhost’;” | mysql -u root
echo “FLUSH PRIVILEGES;” | mysql -u root
#echo “quit” | mysql -u root
echo “Stopping mysql..”
systemctl stop mysqld
echo “Unsetting the mySQL envitroment option so it starts normally next time..”
systemctl unset-environment MYSQLD_OPTS
echo “Start mysql normally..”
systemctl start mysqld

echo “Try to login using your new password:”
mysql -u root -p

tmux quick usage

session management

tmux ls (or tmux list-sessions)
tmux new -s session-name
Ctrl-b d Detach from session
tmux attach -t [session name]
tmux kill-session -t session-name

Ctrl-b c Create new window
Ctrl-b d Detach current client
Ctrl-b l Move to previously selected window
Ctrl-b n Move to the next window
Ctrl-b p Move to the previous window
Ctrl-b & Kill the current window
Ctrl-b , Rename the current window
Ctrl-b q Show pane numbers (used to switch between panes)
Ctrl-b o Switch to the next pane
Ctrl-b ? List all keybindings

moving between windows

Ctrl-b n (Move to the next window)
Ctrl-b p (Move to the previous window)
Ctrl-b l (Move to the previously selected window)
Ctrl-b w (List all windows / window numbers)
Ctrl-b window number (Move to the specified window number, the
default bindings are from 0 — 9)

Tiling commands

Ctrl-b % (Split the window vertically)
CTRL-b ” (Split window horizontally)
Ctrl-b o (Goto next pane)
Ctrl-b q (Show pane numbers, when the numbers show up type the key to go to that pane)
Ctrl-b { (Move the current pane left)
Ctrl-b } (Move the current pane right)

Make a pane its own window

Ctrl-b : “break-pane”

add to ~/.tmux.conf

bind | split-window -h
bind – split-window -v