Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the Shell script of submitting code to SVN server regularly under Ubuntu

2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article focuses on "how to implement the Shell script that regularly submits code to the SVN server under Ubuntu". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn how to implement the Shell script that regularly submits code to the SVN server under Ubuntu.

There are two uses, one is to be lazy not to submit code, and the other is to use it on a remote server for regular backups.

The code is as follows:

Sudo gedit / etc/crontab

Open it and join the line.

The code is as follows:

0 * my_user_name my_script_path

Indicates that each hour executes my_script_path as my_user_name. It is best to use the current user name and modify the default root, otherwise the submission may fail as root. For more information, please ask the usage of Baidu crontab.

Then the content of the script is:

The code is as follows:

#! / bin/bash

Cd $my_code_path

# add all new files

Svn st | grep "?\ +" | sed "sUnip?\ + / /" | xargs svn add

# Delete all missing files locally

Svn st | grep "!\ +" | sed "splash!\ + / /" | xargs svn delete

# submit

Svn ci-m 'auto commit by script'

You can also copy or softly link the script to / etc/crontab without modifying / etc/cron.hourly/, and use su to switch users in the script, and change it to:

The code is as follows:

#! / bin/bash

Su-your_user_name

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

  • How to realize the sliding scoring effect of uniapp

    This article mainly introduces uniapp how to achieve sliding scoring effect, the article introduces in great detail, has a certain reference value, interested friends must read it! Uniapp development, slide score, click score

    © 2024 shulou.com SLNews company. All rights reserved.

    12
    Report