#!/bin/bash# This is a code originally intended to use the automatic backup data, due to the test process has been unable to connect problems, resulting in the inability to test, # then finally gave up the code of the further development, but the record is still necessary Login_url='Xxxxxxxxx:2083/login/?login_only=1'Cookie_file='Cookies'Login_params="--save-cookies $cookie _file--keep-session-cookies--post-data= ' user=z&pass=q '--referer= ' xxxxxxxx:2083/' --no-check-certificate"Download_params="--save-cookies $cookie _file--keep-session-cookies--load-cookies $cookie _file--referer= ' xxxxxxx:2083/{{ Session_id}}/frontend/paper_lantern/backup/index.html '--no-check-certificate"Backup_url='xxxxxxxx/{{session_id}}/getsqlbackup/z_zengjf.sql.gz'Login() { wget$login _params"$login _url"-O-Exit #return_html=$(wget$login _params"$login _url 2>/dev/null"-O-) session_id=$(Echo "$return _html"|awk-f/'{print $}')}download () {URL=$(Echo "$backup _url"|sed-R"s/\{\{session_id\}\}/$session _id/") Params=$(Echo "$download _params"|sed-R"s/\{\{session_id\}\}/$session _id/") file_name="blog_db_$ (date + '%y%m%d%h%m%s '). sql.gz" wget$params"$url"-O $file _name}clean () {RM-f $cookie _file}Login#download #clean
Linux wget Auto Login and Backup Database