Linux一些常见脚本
Posted andy-shi
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux一些常见脚本相关的知识,希望对你有一定的参考价值。
挂载
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=7008
-Xdebug -Xrunjdwp:transport=dt_socket,address=7777,server=y,suspend=n
sudo mount -t nfs 172.16.7.168:/disk4/SoftWare/App /mnt/install
172.16.29.199:/backup100/SoftWare
dml
set define off
@@xxdml.sql
提tracker
https://alm.ebaotech.com/sf/tracker/do/listTrackers/projects.ts_help_desk/tracker
sudo mount -t cifs //172.25.16.224/prod_dev /usr/local/MHL_PROD_PATCH_DEV/weblogic10/user_projects/domains/base_domain/EBAO_ARCH_HOME/document -o username=administrator,password=Ebaotech250,Domain=SHVM00580,mode=777,uid=500,gid=501
sudo mount -t cifs //172.25.12.191/msig_r2_tst2 /usr/local/msig_r2_tst2/weblogic/user_projects/domains/base_domain/EBAO_ARCH_HOME/print_archive_data -o username=Administrator,password=Ebaotech250,Domain=SHVM00668,mode=777,uid=501,gid=501
websphere 8.5 172.16.7.91 eBao1234
/usr/local/ls_36_pfm_was85/IBM/InstallationManager/eclips
/mnt/install/WAS/8.5/was.repo.8500.developers.ilan_part/repository.config
查看用户所属组 groups
查看占用端口8080 的进程
lsof -i:8080
more etc/rc.local
more etc/mta
查看cpu sar 1 111
查看内存 vmstat 1 10
72,lvextend -L+20G /dev/tank/part1 //向part1这个分区增加20G的空间
73,lvresize -L-10G /dev/tank/part2 //向part2这个分区减少10G的空间
74,pvdisplay //查看磁盘信息
查看系统版本
[[email protected] base_domain]$ cat /etc/centos-release
CentOS release 6.4 (Final)
[[email protected] base_domain]$ cat /etc/issue
CentOS release 6.4 (Final)
Kernel \r on an \m
[[email protected] base_domain]$ uname -r
2.6.32-358.el6.x86_64
[[email protected] base_domain]$ more /proc/version
Linux version 2.6.32-358.el6.x86_64 ([email protected]) (gcc version 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC) ) #1 SMP Fri Feb 22 00:31:26 UTC 2013
md5值
md5sum MLI_V4.0.22P04_20141211.zip
weblogic 停止命令
kill -9 ` ps -ef|grep java|grep dahsing_ma_pro_tst|grep weblogic|grep -v "grep"|grep -v batch|awk ‘{print $2}‘`
热部署
-javaagent:/usr/local/sbi_gs33_tst/weblogic/user_projects/domains/base_domain/jrebel.jar
--热启动
-javaagent:/appl/gs33_b24_branch/bea/user_projects/domains/gc_domain/jrebel.jar
JMX端口
USER_MEM_ARGS="-noverify -Djava.rmi.server.hostname=172.25.18.108 -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.port=15009 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
改文件
/
for zip_files in `find ./app_config -type f `
do
sed -i "s#原绝对路径#现绝对路径#g" $zip_files
echo "$zip_files is done"
done
samba
[ace_ht_beta_tst_share]
path = /usr/local/ace_ht_beta_tst/weblogic10/user_projects/domains/base_domain
public= no
writable = no
guest ok = no
browseable = yes
valid users =ace_ht_beta_tst
/etc/init.d/smb restart
/etc/init.d/nmb restart
smbpasswd -a ace_ht_beta_tst
复权 vi /etc/hosts.allow
grep -R GCS_URL_PREFIX *
select * from databasechangelog t
ps -eLf | grep java | wc -l
heapdump
[[email protected] ~]$ export DISPLAY=172.18.6.21:0.0
[[email protected] ~]$ ./jdk1.7.0/bin/java -jar -Xmx10000m ha454.jar /usr/local/heapdump/hui/java_pid4523.hprof.March_4_13h58/home/lfs_p1/java_pid4523.hprof
./jdk1.7.0/bin/java -jar -Xmx10000m jca455.jar
mapped: 1377188K writeable/private: 1167888K shared: 199056K
[[email protected] j2ee]$ pmap -d 28816
无密码
----------------------------------------------------------------
ssh-keygen -t rsa
scp id_rsa.pub [email protected]:/home/nic_gs_pfm_tst/.ssh/172.25.17.142
cat 172.25.17.142 >> authorized_keys
chmod 755 .ssh
chmod 644 authorized_keys
-------------------------------------------------------------
/*******************************
ps -Af|grep agent
ssh-agent
ssh-add id_rsa
*****************************/
ftp:
#!/bin/bash
date
ftp -n <<EOF
open 172.25.17.168
user ace_ina_38_sp_mt_tst ace_ina_38_sp_mt_tst
bin
prompt
cd /usr/local/ace_ina_38_sp_mt_tst/Oracle/Middleware/user_projects/domains/base_domain/patch_deploy
get $1
bye
EOF
date
##########################################
grep -ie ^ORA- -ie ^SP2- -ie ^IMP- -ie ^PLS- -ie "<error>" -ie "O/S Message:" $1 >>/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "EBER-008: dbscript or plsql deployed with error."
echo ""
echo "---------------start of error context-------------------"
grep @ $1|tail -1
for keyword in ^ORA- ^SP2- ^IMP- ^PLS- "O\/S Message:" "<error>"
do
for j in `sed -n "/$keyword/=" $1`
do
sed -n $(($j-5)),$(($j+0))p $1
done
done
echo "---------------end of error context-------------------"
echo ""
echo "Deployment failed, Please check log $1 for more details."
echo ""
exit 1
else
echo_success |tee -a ${PKG_PATH}/${V_LOG}
echo ""
[ `uname` = "AIX" ] || echo ""
fi
##################################################################
Linux下载百度网盘
wget -c -O laozuo.org.zip "http://www.baidupcs.com/file/87671d01a637b83e597d44ab5a7353e7fid=1765086594-250528-727172238&time=1364708675&sign=FDTA-DCb740ccc5511e5e8fedcff06b081203-pSaeI6stZfWuVhasK0IeL%2F3rREg%3D&expires=8h&sh=1&response-cache-control=private"
------------------------
查jar包中的class
find . -name ‘*.jar‘ | while read LINE; do grep -q org.apache.tools.ant.launch.Launcher.class "$LINE"; if [ $? -eq 0 ];then echo "$LINE";fi;done
find . -name ‘*.jar‘ | while read LINE; do grep -q org.apache.tools.ant.launch.Launcher "$LINE"; if [ $? -eq 0 ];then echo "$LINE";fi;done
-------------------------------------
检查文件中文件是否存在。
myFolder=/home/test
files=`ls $myFolder`
if [ -z "$files" ]; then
echo "Folder $myFolder is empty!"
else
echo "Folder $myFolder is not empty."
fi
------------------------------------------------
检查磁盘读写
dd if=/dev/zero of=/tmp/test001 bs=1M count=1024
---------------------------------------------
开启ias console服务
emctl start iasconsole
---------------------------------
ftp 增加删除log
需要修改如下参数设置记录删除和新建文件日志 ,在/etc/vsftpd/vsftpd.conf 添加dual_log_enable=yes
可以用ps和grep命令寻找僵尸进程
ps -A -ostat,ppid,pid,cmd | grep -e ‘^[Zz]‘
----------------------------------------------
export ANT_HOME=${PKG_DIR}/apache-ant
export CLASSPATH=.:${ANT_HOME}/lib:${ANT_HOME}/lib/ant-launcher.jar
--------------------------------------------------------
windows 下手动安装.net framework 3.5----------------
Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU‘ -Name UseWUServer -Value 0
Restart-Service -Name wuauserv
Install-WindowsFeature Net-Framework-Core
Set-ItemProperty -Path ‘HKLM:\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate\AU‘ -Name UseWUServer -Value 1
Restart-Service -Name wuauserv
Dism /online /enable-feature /featurename:netfx3 /All /Source:"C:\Sources\SxS\"
-----------------------------------------------------------------------------------------
find . -name ‘*.jar‘|while read i; do jar tvf $i|grep "org.antlr.runtime.Parser" && echo $i; done
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
--------------------------------------
select count(1) from v$process;
show parameter process
对比下2个结果
SQL> show parameter process;
-------------------------------------
重新生成was 证书
/usr/local/was/IBM/WebSphere/AppServer/profiles/aig_sg_07_pre_tst/etc/key.p12
/usr/local/was/IBM/WebSphere/AppServer/profiles/aig_sg_07_pre_tst/etc/trust.p12
/usr/local/was/IBM/WebSphere/AppServer/profiles/aig_sg_07_pre_tst/config/cells/aig_sg_07_pre_tstCell/nodes/aig_sg_07_pre_tstNode/key.p12
/usr/local/was/IBM/WebSphere/AppServer/profiles/aig_sg_07_pre_tst/config/cells/aig_sg_07_pre_tstCell/nodes/aig_sg_07_pre_tstNode/trust.p12
./bin/wsadmin.sh
-----------------------------------------------------------------------
fuser -m -v /u02/app/oracle/product/ofm12.1.2/user_projects/domains/base_domain/EBAO_ARCH_HOME/document
umount //10.3.125.165/print_archive_data/ual_ls_dc_uat
以上是关于Linux一些常见脚本的主要内容,如果未能解决你的问题,请参考以下文章