Newlisp backs up the GIT lab System

Source: Internet
Author: User

The followingCodeBoth are newlisp. With the help of crontab, the GIT repository and MySQL database are backed up regularly. Because the GIT lab data is stored here.

In fact, newlisp is suitable for O & M scripts.

Git_backup.lsp file:

 
(Set 'Folder-Name (date-value) 0 "% Y-% m-% d") (println folder-name) (set 'Folder-name2 (date-value)-2880 "% Y-% m-% d ")) (set 'base-path "/opt/cmdon110/BK/git/") (println folder-name2) (make-Dir (append base-path folder-name )) (Exec (APPEND "CP-r/home/git/repositories" base-path folder-name) (if (file? (Append base-path folder-name2) (Exec (APPEND "RM-RF" base-path folder-name2) (Exit)

Mysql_backup.lsp file:

File edit options buffers tools lisp help (set 'Folder-Name (date-value) 0 "% Y-% m-% d") (println folder-name) (set 'Folder-name2 (date-value)-2880 "% Y-% m-% d ")) (set 'base-path "/opt/mongoon110/BK/MySQL/") (println folder-name2) (make-Dir (append base-path folder-name )) (Exec (APPEND "mysqldump-u root-pyour_pwd -- all-databases>" base-path folder-name "/all-database. SQL") (if (file? (Append base-path folder-name2) (Exec (APPEND "RM-RF" base-path folder-name2) (Exit)

Note that the newlisp file operation API cannot easily copy directories, so the Linux Command CP-R is also used here.

In the future, consider writing one by yourself. Or wait for Lutz to add this API?

Crontab Configuration:

 
50 23 *** newlisp/opt/git_backup.lsp40 23 *** newlisp/opt/mysql_backup.lsp

The premise is that newlisp has been installed in Ubuntu.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.