Run the. sh script periodically in Ubuntu.

Source: Internet
Author: User
Back up the code uploaded by svn in Ubuntu and name the backup file svn_backup + current time. dump File (for example, svn_backup20100525.dump) 1. write a script file (backup. sh) sudotouchbackup. sh create a script file and edit the file sudovimbackup. sh is the content of the configuration file. The Code is as follows :#! /Bin/shsudosvnadmin

Back up the svn upload code in Ubuntu and name the backup file svn_backup + current time. dump (for example, svn_backup20100525.dump)

1. Write a script file (backup. sh)

Sudo touch backup. sh

Create a script file and edit the file

Sudo vim backup. sh

The Code is as follows:

#! /Bin/sh

Sudo svnadmin dump/srv/svn/repos/works>/home/jordy/svn_back_up $ (date + % Y % m % d). dump

Echo success!

Back up the code under the/srv/svn/repos/works directory to the/home/jordy/directory. The file name is

Svn_backup + current time. dump File. The last sentence only prompts that the backup is successful and can be deleted.

Use commands

Sh-x backup. sh

Test whether the script is successful.

After the preceding script file is compiled, run the following scheduled task:

Sudo vim/etc/crontab

The last line in the code, where:

Indicates the backup time. Fill in the data according to m h dom mon dow and execute the data every minute during my test.

Backup. sh script file.

After the operation is complete, you can go to the corresponding directory to check whether the backup file is generated.

Related Article

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.