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

A simple shell script that generates files in a fixed format

2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

#! / bin/sh

File1=$ (date +% Y%m%d%H%M%S) # defines a variable to get the current time

ALM_TYPE=BOSS4ZC # define variables

INSTANCE_ID=62100408# defines variables

STATUS=MAJOR# defines variables

ALM_INFO=Mysql standby host downtime 10.09.62. Please deal with it in time. # define variables

ALM_TIME=$ (date +'% Y-%m-%d% HRV% MVA% S') # define variables

File2=$INSTANCE_ID.# defines variables

File3=.alm# defines variables

File_name=$file2 $file1 $file3# defines variables

Cd / nms/almd/data/alm # enters a fixed path

Touch $file_name # create file

Chown nms $INSTANCE_ID* # modify file user

Chgrp bomc $INSTANCE_ID* # modify filegroup

Echo $ALM_TYPE ";" $INSTANCE_ID ";" $STATUS ";" $ALM_INFO ";" $ALM_TIME > > $file_name # redirect to file

File1_name=$file2 $file3 # defines variables

Touch $file1_name # create file

If [!-f "$file1_name"] # judge if the file does not exist

Then

Echo "$host mysql login successfully"

Exit 0

Else

# echo "$host mysql login faild"

Mv / home/mysql/check_mysql_alarm.sh / home/mysql/check_mysql_alarm1.sh

Exit 2

Fi

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

Database

Wechat

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

12
Report