A story about a tragedy happening by exchanging commands in chat

Introduction

I was a little nervous when I was managing the server It's really embarrassing and ridiculous, but I wrote an article as a commandment to myself.

TLDL; —— Obviously, use `` (backticks) properly when sending code snippets and commands over chat. Otherwise, the symbol will be recognized as Markdown and it may be difficult. * Depending on the notation, ~ (tilde) is OK ――It is natural, but let's check the contents of the OS command to be executed before executing it. ――It's natural, but let's do log rotation

What happened

The Jira server used in the department did not start, so we investigated the cause with two people The bloated Jira log files were eating up storage.

So, looking at the log contents of Jira, the log rotation is not solid The file was not compressed or deleted.

ls result


[root@jira ~]# ls -ahl /opt/atlassian/jira/logs/
total 59G
drwx------  2 jira root  68K Jan 24 03:45 .
drwxr-xr-x 15 root root 4.0K Feb 25  2016 ..
-rw-r--r--  1 jira jira 1.2K Jul  1  2019 catalina.2019-07-01.log
-rw-r--r--  1 jira jira 3.8K Jul  2  2019 catalina.2019-07-02.log
-rw-r--r--  1 jira jira 1.5K Jul  5  2019 catalina.2019-07-05.log
-rw-r--r--  1 jira jira 1.5K Jul  5  2019 catalina.2019-07-05.log
-rw-r--r--  1 jira jira    0 Jan 24 03:45 catalina.out

Therefore

  1. As a temporary measure, "Delete the catalina.xxxxx.log file created 30 days ago" among the accumulated log files.
  2. Introduction of log rotation as full-scale support (compression / deletion of files)

Decided to do.

I was surprised when I took action in 1.

The command I wanted to type


[root@jira ~]# find /opt/atlassian/jira/logs/*.*.* -mtime +30 | xargs rm

Created 30 days ago under / opt / atlassian / jira / logs / (strictly modified) Deleted *. *. * (E.g. catalina.2019-07-05.log etc.).

The member I was working with wrote a command to delete the target file in chat and sent it to me.

図1.png

It was. I noticed before typing the command, but if I type it as it is, it will blow away the upper directory of / opt / atlassian / jira / logs / and it will be a big deal ...

What happened

On chat

find /opt/atlassian/jira/logs/*.*.* -mtime +30 | xargs rm

When you hit, the *. * Part of the first half of *. *. * Is Markdown's [emphasis](https://qiita.com/tbpgr/items/989c6badefff69377da7#-%E5%BC%B7%E8 % AA% BFem) was judged and it was italicized.

However,

Normal dot Italic dots
. .

Hmm? ?? Looking for a mistake? ??

I don't know if the dots are italic by looking at the putt.

It was good because I saw the command properly, but what happened if my brain died and I was playing the command ...

in conclusion

Codes and commands have various symbols that are also used in Markdown.

In a scene where you can quickly send code snippets and commands on chat Firmly, if you don't use `` (backticks) `, it may be difficult in the future. I realized it.

Recommended Posts

A story about a tragedy happening by exchanging commands in chat
A story about data analysis by machine learning
A story about making a tanka by chance with Sudachi Py
A story about a tragedy happening by exchanging commands in chat
A super introduction to Linux
What is a super user?
A story about data analysis by machine learning
A story about a Linux beginner passing LPIC101 in a week
A story about how to specify a relative path in python.
A story about competing with a friend in Othello AI Preparation
A story about making a tanka by chance with Sudachi Py
A story about trying to implement a private variable in Python.
A story about a beginner participating in a project by Django from team building to product release in 6 weeks
A story about a build error in a shared library that references libusb
A refreshing story about Python's Slice
A sloppy story about Python's Slice
A story about using Python's reduce
A story about a beginner making a VTuber notification bot from scratch in Python
[Memorandum] A story about trying OpenCV tutorial (face recognition) in a Windows environment
A story about remodeling Lubuntu into a Chromebook
A story about machine learning with Kyasuket
A story about Python pop and append
A story about a 503 error on Heroku open
Escape from Python's virtual environment ~ A story about being trapped in a virtual environment I created ~