From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lucy.dinwoodie.org (77.116.2.81.in-addr.arpa [81.2.116.77]) by sourceware.org (Postfix) with ESMTPS id 235B33858D3C for ; Sun, 16 Jan 2022 16:12:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 235B33858D3C Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=dinwoodie.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=dinwoodie.org Received: from adam by lucy.dinwoodie.org with local (Exim 4.94.2) (envelope-from ) id 1n989B-0000Vc-DI for cygwin@cygwin.com; Sun, 16 Jan 2022 16:12:49 +0000 Date: Sun, 16 Jan 2022 16:12:49 +0000 From: Adam Dinwoodie To: cygwin@cygwin.com Subject: Re: Does cygwin have an 'autorun' utility/package? Message-ID: <20220116161249.tvizujlenvqkdyyp@lucy.dinwoodie.org> References: <66df682d-2a2f-7429-39d9-f7b32a79c693@mehconsulting.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <66df682d-2a2f-7429-39d9-f7b32a79c693@mehconsulting.com> X-Spam-Status: No, score=-0.9 required=5.0 tests=BAYES_00, KAM_DMARC_STATUS, PDS_RDNS_DYNAMIC_FP, RDNS_DYNAMIC, SPF_HELO_PASS, SPF_PASS autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 16 Jan 2022 16:12:52 -0000 On Sun, Jan 16, 2022 at 06:46:06AM -0800, Mark Hansen wrote: > I have an application running under Linux which I would like to move to Windows > (with Cygwin). This application depends on getting notifications when a CD Rom > drive status has changed (like audio CD inserted, ejected, etc.). For this, I > use a Linux utility application named 'autorun': > > https://linux.die.net/man/1/autorun > > What's nice about this application is it can be configured to send notifications when > various drive events occur. > > I've looked through the package list for Cygwin and don't see anything like this. > > Does Cygwin have anything that could work? > > My Windows/C skills are about 20 years old so I was hoping to find an existing utility > application that can provide this functionality, rather than try write my own. I don't think Cygwin has anything of this ilk. It's the sort of function that inherently requires some integration with the underlying operating system in ways that the Cygwin compatibility layer makes difficult: a tool providing that sort of function on Cygwin would need to both interface with the underlying Windows OS to get notifications of CD drive events, then provide some sort of *nix-style interface for Cygwin applications to attach to. Depending on precisely what you need, you might be able to automate things with a simple Bash/Python/whatever script. Something like the following would let you run a specific program when a CD is inserted into drive D:, for example: #!/usr/bin/env bash set -eu while :; do if [[ -e /cygdrive/d ]]; then echo "CD detected, running '$PROGRAM'" cygstart "$PROGRAM" else echo 'No CD detected' fi sleep 60 done HTH Adam