From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id E93231381F3 for ; Thu, 11 Jul 2013 04:47:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 7DD5DE09EA; Thu, 11 Jul 2013 04:47:30 +0000 (UTC) Received: from mail-wi0-f180.google.com (mail-wi0-f180.google.com [209.85.212.180]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 571B0E0982 for ; Thu, 11 Jul 2013 04:47:29 +0000 (UTC) Received: by mail-wi0-f180.google.com with SMTP id c10so7072696wiw.7 for ; Wed, 10 Jul 2013 21:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=iIut9GApBdf10yOUkSzjbMd2/gus74rS5watejC3KtQ=; b=Ofgq8um3hKOTRK1Z9E4K+0PxUbh4ncU55vtP5LqUH61ecKzseHywcXLo6OGXKf7QnM 4N3R+t636KEpTq/PWvd8zFdpIRXnw2DefxzI7Ebo6Xzv46meTIpKNrtfOVwRrsBqO4Ve WY3b+FRwGF/Zcvi1picx5VbhCrRPBUpAoAjFnvls6UcRQyfByKlPKTPeQ4KCVQMSfYZc MpxV2WqZS2QNWC0u7dvoSw58CXRGH52A2+6mWs0z3/9pVgIWL4Vh5a58jRaH4/tMZN5u CJbTtkF//OsT56309E8UnBwyieuRDPYseKTmOxfDX/4g/qXUtjbuu2ibHSDLg10dDT8w /kdw== X-Received: by 10.180.206.164 with SMTP id lp4mr36807921wic.1.1373518047900; Wed, 10 Jul 2013 21:47:27 -0700 (PDT) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.194.87.227 with HTTP; Wed, 10 Jul 2013 21:47:07 -0700 (PDT) In-Reply-To: <20130711024822.GB17831@syscon7.inet> References: <20130709165430.GC24522@syscon7.inet> <51DD2792.70308@gmail.com> <20130711024822.GB17831@syscon7.inet> From: Wang Xuerui Date: Thu, 11 Jul 2013 12:47:07 +0800 Message-ID: Subject: Re: [gentoo-user] pop up windows with text message To: gentoo-user@lists.gentoo.org Content-Type: text/plain; charset=UTF-8 X-Archives-Salt: 0509cffa-5525-42b0-8ab8-4129d604702c X-Archives-Hash: 73ed11dec70604e1ef15c45a907c96b3 2013/7/11 Joseph : > I just want to monitor one file in a directory. > I usually copy the file over the network to another computer (same file > name) I'll overwrite the file. > > Once I copy the file, the system should notify a use that new file exist (a > message pop-up). If the use closes the message and will not open the file, > after few ours I want to remind the user that the file has not been open > yet. > > Will it be very complicated to write a bash script like this? I once wrote a small Python script to help me with automating Git-based deployments, but it's simple enough to be suitable for a variety of use cases: https://github.com/xen0n/touchmon It allows you to specify a hook for each file observed, just make sure the watched file exists before starting the watcher (a known limitation). Inside the hook script (any language is OK) you can pop-up a dialog and store a timestamp somewhere, if the user has the file opened for him/her. Then for the periodic notofication, maybe a cronjob would suffice? Simply check the stored timestamp with the current time. If polling is not what you want, you can extend the inotify part to also monitor events like IN_OPEN or IN_ACCESS and manipulate your timer accordingly. But be aware of false positives like some background daemon accessing the file, as ALL opens and reads are watched. Hope this helps~