inotifywait actual operation

Source: Internet
Author: User
Tags inotify

In order to achieve the project picture resources upload, you can automatically compression, to speed up user access speed, found this technology inotify, about this technology specific introduction, here no longer verbose, Baidu a search has a lot of introduction.

Here is a single example to introduce the use of inotifywait

Vi/tmp/monitor_jpg.sh#!/bin/bashexport Lang=cinotifywait-mrq--event create,modify/data/jpg | While read eventdonewfile= ' ls-ltc/data/jpg | Grep-v Total | Head-n 1 | awk ' {print $9} ' convert-quality 25%/data/jpg/$newfile/data/conjpg/$newfiledone #wq Save exit # Permission change and put into background process chmod 700 Monitor_jjpg.shnohup/bin/bash/tmp/monitor_jpg.sh &


The purpose of the above script is to use the ImageMagick software to compress the image (approximately 1//data/jpg) when a picture is altered or created (depending on the file modification or creation time) when the image is monitored in the directory. 3 size) to the directory/data/conjpg/directory, save with the same name file.

When the site needs to refer to the picture, you can refer to/data/conjpg inside the picture, a lot of saving network bandwidth resources.

With regard to the INotify function, this is used only by the iceberg, reasonable use, also can achieve the project Automation release and rollback, but no longer manual participation in the publishing process

This article is from the "Letter" blog, please be sure to keep this source http://leon0long.blog.51cto.com/3011404/1633389

inotifywait actual operation

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.