linux 腳本記錄

1、linux設置時間(與授時服務器同步   定時器)
     定時器   crontab -e
     0 23 * * * /usr/sbin/ntpdate 210.167.182.10>>/root/ntpdatelog.txt

 

2、文件權限 

    2.1、 修改文件權限
         chmod 777 test.txt
    2.2、 修改文件夾及子文件夾權限
         chmod -R 777 /home/test/test

 

3、mysql備份

    3.1、mysql備份導出
           mysqldump -uroot -ppasswd  --skip-lock-tables --single-transaction tsp_surface > /mnt/data2/tsp_surface_0318.sql
     3.2、mysql備份導入
          mysql -utsp -ppasswd scrm_71 < /tmp/mnt/data2/scrm_0328.sql

 

 4、壓縮解壓

     4.1、文件壓縮

          tar -zcvf catalina.out.tar.gz catalina.out

     4.2、解壓
          tar -zxvf /tmp/catalina.out.tar.gz /tmp/

 

5、線程

     5.1、顯示所有在運行的線程

         ps -ef

     5.2、按條件搜索運行的線程

         ps -ef|grep surface|grep tomcat |grep tsp

     5.3、終止指定線程
         kill -9 ???

6、文件拷貝

     6.1、本地複製

           cp  /home/tsp/tsp-surface/tsp-surface/branches/release/build/surface.war /home/tsp/tsp-surface/online/

    6.2、遠程複製(下載)

           scp [email protected]:/home/tsp/tsp-surface/surface.war ./surface/build/
           scp -P 50022 [email protected]:/home/tsp/tsp-surface/surface.war ./surface/build/

 

7、其他

     7.1、關鍵字搜索

          more catalina.out | grep 關鍵字

     7.2、動態日誌

         tail -f /tsp/tsp-surface/apache-tomcat-6.0.35/logs/catalina.out

 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章