時常用到linux命令及其他雜七雜八命令

記錄一下,部分工作中首次遇到的小問題,當時卻花費了很多時間去解決的東西。

  1. linux批量關鍵詞刪除文件
find /data/work/ptop/ -name '*_201810*' |xargs rm -rf
  1. python調用cx_Oracle包時,定時器不起作用,原因:cx_Oracle需要依賴oracle的ORACLE_HOME環境。環境變量定義時,ORACLE_HOME定義在/etc/profile下,在這裏修改的內容是對所有用戶起作用的,但是對crontab是不起作用,解決方式:crontab中添加ORACLE_HOME路徑:
0 7 * * * . /etc/profile; /usr/bin/python /data/ptop/online.py >>/data/ptop/online.log 2>&1
  1. linux後臺運行python代碼時,log緩存,不能立刻輸出:加 “-u”即可。
nohup python -u ptop_online.py >> ptop_online.log 2>&1 &
  1. linux用戶權限限制,進入root用戶操作:
sudo -i
  1. 查看mysql數據庫、表大小,對應修改表名及數據庫名即可,也可轉換單位:
select concat(round(sum(DATA_LENGTH/1024/1024),2),'M') table_space
from information_schema.tables  
where table_schema='data_summary' AND table_name='user_detail_info';
  1. windows下設置定時器:
    schtasks參數設置參考鏈接:參考url
//首先創建.bat文件
// schtasks命令創建定時器
schtasks /create /sc minute /mo 1 /tn "RunPerOneMinuts" /tr E:\update_file_bj.bat //創建
schtasks /delete /tn RunPerOneMinuts /f//刪除
  1. win10系統 64位 查看pip支持的文件名及版本,解決.whl is not a supported wheel on this platform問題:
import pip._internal
print(pip._internal.pep425tags.get_supported())
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章