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 understand timed task crontab

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail how to understand the timed task crontab, the content of the article is of high quality, so the editor will share it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Script directory:

[oracle@tangjian] $mkdir-p / u01/app/oracle/rman/scripts/

Archive directory:

[oracle@tangjian] $mkdir-p / u01/app/oracle/rman/arch/

Create script: (0 level increment once a month)

[oracle@tangjian ~] $vi / u01/app/oracle/rman/scripts/full_backup_run.sh

#! / bin/bash

# Usage:test database hot full backup!

Export PATH

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

Export ORACLE_SID=test

Export PATH=$PATH:$ORACLE_HOME/bin

DATE=$ (date +% Y%m%d)

Mkdir-p / u01/app/oracle/rman/$DATE

Rman target / & 1

View the task list:

[oracle@tangjian 20180730] $crontab-l

Create script: (1 level difference increment once a week)

[oracle@tangjian ~] $vi / u01/app/oracle/rman/scripts/level_backup_run.sh

#! / bin/bash

# Usage:test database hot full backup!

Export PATH

Export ORACLE_BASE=/u01/app/oracle

Export ORACLE_HOME=$ORACLE_BASE/product/11.2.0/dbhome_1

Export ORACLE_SID=test

Export PATH=$PATH:$HOME/bin:$ORACLE_HOME/bin

DATE=$ (date +% Y%m%d)

Mkdir-p / u01/app/oracle/rman/level/$DATE

Rman target / & 1

# rman backup level database shell

00 1 * * 7 / u01/app/oracle/rman/scripts/level_backup_run.sh 1 > / tmp/rman_backup_full.log 2 > & 1

Verify script availability:

[oracle@tangjian scripts] $sh full_backup_run.sh

[oracle@tangjian scripts] $sh level_backup_run.sh

Common commands:

/ sbin/service crond start start the service

/ sbin/service crond stop shuts down service

/ sbin/service crond restart restart the service

/ sbin/service crond reload reload configuration

Add (boot-up) at the end of the script / etc/rc.d/rc.local:

/ sbin/service crond start

Crontab-u sets a user's cron service. Generally, root users need this parameter when executing this command.

Crontab-l lists the details of a user's cron service

Crontab-r delete a user's cron service

Crontab-e edits a user's cron service

On how to understand the timed task crontab to share here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Servers

Wechat

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

12
Report