FastHandle is fast operation tools for infrastructure configurations and tests.
This shows you the differences between two versions of the page.
| Both sides previous revision Previous revision Next revision | Previous revision | ||
|
operation:one-line-task.html [2018/02/21 23:43] kurihara ↷ Page name changed from operation:remote-shell-commands.html to operation:temporary-run-call.html |
operation:one-line-task.html [2020/01/23 02:18] (current) kurihara |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| [[: | [[: | ||
| - | ====== Fabric | + | ====== Fabric |
| \\ | \\ | ||
| Line 6: | Line 6: | ||
| \\ | \\ | ||
| - | ===== What is a temporary run call ===== | + | ===== What is a one-line taks ===== |
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| $ fab [options] -- [shell command] | $ fab [options] -- [shell command] | ||
| Line 17: | Line 17: | ||
| \\ | \\ | ||
| - | ===== Command | + | ===== Fabric |
| ==== Basic ==== | ==== Basic ==== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| $ H=test-server-1, | $ H=test-server-1, | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- hostname |
| </ | </ | ||
| Line 30: | Line 30: | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| $ H=test-server-1, | $ H=test-server-1, | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- id nginx |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "cat /etc/passwd |grep xxx" |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "sudo cat /etc/shadow |grep xxx" |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "cat /etc/group |grep xxx" |
| </ | </ | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "echo ' |
| </ | </ | ||
| Line 45: | Line 45: | ||
| ==Interface== | ==Interface== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "ip a |grep inet" |
| </ | </ | ||
| Line 51: | Line 51: | ||
| ==Bonding== | ==Bonding== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- egrep " |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- egrep -i " |
| </ | </ | ||
| Line 60: | Line 60: | ||
| == Routing== | == Routing== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- netstat -rn |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- cat / |
| </ | </ | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo /sbin/route add -net 192.168.0.0 netmask 255.255.255.0 gw 192.168.0.1 |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo route del -net 192.168.10.0 netmask 255.255.255.0 |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo cp -p / |
| - | $ fab -H $H auth.pro | + | |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo sed -i s/ |
| - | $ fab -H $H auth.pro | + | |
| + | $ fab -H $H -- sudo "bash -c 'sed s/192.168.100.10/192.168.50.10/g / | ||
| + | $ fab -H $H -- sudo "bash -c 'echo "any host 192.168.100.1 gw 192.168.0.5" | ||
| </ | </ | ||
| Line 76: | Line 78: | ||
| ==Check Network Connection== | ==Check Network Connection== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo nmap -Pn -sT -p 22 xx.xx.xx.xx |
| </ | </ | ||
| Line 82: | Line 84: | ||
| ==tcpdump== | ==tcpdump== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo tcpdump |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo tcpdump -n not arp and not port 123 and not port 22 -W1 -G30 |
| </ | </ | ||
| * '' | * '' | ||
| Line 92: | Line 94: | ||
| ==== DNS ==== | ==== DNS ==== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- cat / |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- host google.com |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- host test-server-01 |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- host x.x.x.x |
| + | $ fab -H $H -- host -t any google.com 8.8.8.8 | ||
| + | $ fab -H $H -- host -t soa google.com 8.8.8.8 | ||
| + | |||
| + | $ fab -H $H -- dig @8.8.8.8 google.com any | ||
| + | $ fab -H $H -- dig google.com mx | ||
| </ | </ | ||
| Line 104: | Line 111: | ||
| ==== Disk ==== | ==== Disk ==== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- df -h |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- mount |
| </ | </ | ||
| Line 112: | Line 119: | ||
| ==== NTP ==== | ==== NTP ==== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- chronyc sources |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- chronyc sources -v |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- ntpq -p |
| </ | </ | ||
| Line 123: | Line 130: | ||
| $ H=test-server-1, | $ H=test-server-1, | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo cp -p / |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sudo cp -p / |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- diff / |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- diff / |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sdiff -s / |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- sdiff -s / |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- tree -Dpuga |
| </ | </ | ||
| Line 142: | Line 149: | ||
| ==Max open files== | ==Max open files== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- cat / |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- cat / |
| </ | </ | ||
| + | |||
| + | \\ | ||
| + | \\ | ||
| + | ==== Log ==== | ||
| + | === Tailing log files on multiple machines === | ||
| + | <sxh bash toolbar: | ||
| + | $ fab -P --linewise -H host1, | ||
| + | </ | ||
| + | Refelrence [[http:// | ||
| + | |||
| \\ | \\ | ||
| Line 150: | Line 167: | ||
| ==== Package ==== | ==== Package ==== | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "ps -ef |grep nginx" |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- ' |
| </ | </ | ||
| ==RHEL/ | ==RHEL/ | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "sudo yum install -y openssl" |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "rpm -q nginx" |
| # Check the installed rpm order by date. | # Check the installed rpm order by date. | ||
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "rpm -qa --last | head -30" |
| - | $ fab -H $H auth.pro | + | $ fab -H $H -- "sudo systemctl reload httpd.service" |
| </ | </ | ||
| Line 178: | Line 195: | ||
| <sxh bash toolbar: | <sxh bash toolbar: | ||
| - | [fasthandle@server1 ~]$ fab -H server2 | + | [fasthandle@server1 ~]$ fab -H server2 |
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||
| \\ | \\ | ||
My Sites
SNS
Copyright (c) 2025 FastHandle - IT Operations Examples All Rights Reserved.