Some code materials that can be reused (2)

xiaoxiao2021-03-06  47

1. Some examples of call Linux shell instructions: String cmd = "ls / home / log / daily / count * | cut -d '' -f1> / home / log / tmp_cmd"; process.system (cmd) Use the Linun Shell instruction to enter the fields in a file into another temporary file String cmd = "tail -n200 /home/log/tell.log> / home / log / tmp_tell_log"; process.system (cmd);

2. <% response.setContentType (" text / vnd.wap.wml; charset = GB2312 ");%> <% @ page import =" java.net. *, Java.util. *, Java. IO. * "%> <% @ page language =" java "contentty =" text / vnd.wap.wml; charset = GB2312 "%> <% DATE DATE = new Date (); string random_user = long.toString (Date .gettime ()); response.sendredirect (http://192.168.0.225/xxx.jsp?_user= " random_user);%>

3. Regular expression LS -L | GREP ^ D lists all directories in the current directory, excluding other files, only a directory.

4.Mysql database backup mysqldump -uroot -Password dbname> /Home/xxx/xxx.sql written in crontab automatic backup crontab -e00 3 * * * (/ bin / sh /Home/qianglee/mysqlback/backmysql.sh)

script:

#! / bin / sh

Export Path = $ PATH: / USR / local / bin: / usr / bin: / usr / local / sbin

Date = `DATE % Y% M% D`Yesterday =` echo "| awk '{now = systime (); p = strftime ("% y-% M-% D ", NOW-24 * 60 * 60 PRINT P} '`Echo $ DATEFILENAME =` Echo $ DATE | awk' {print "DBNAME" $ 0 ".bak"} '`Echo $ filenamememysqldump -uroot -Password dbname> / home / xxx / xxxback / $ filename

转载请注明原文地址:https://www.9cbs.com/read-80779.html

New Post(0)