public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Adam Dinwoodie <adam@dinwoodie.org>
To: cygwin@cygwin.com
Subject: Re: Does cygwin have an 'autorun' utility/package?
Date: Sun, 16 Jan 2022 16:12:49 +0000	[thread overview]
Message-ID: <20220116161249.tvizujlenvqkdyyp@lucy.dinwoodie.org> (raw)
In-Reply-To: <66df682d-2a2f-7429-39d9-f7b32a79c693@mehconsulting.com>

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

  reply	other threads:[~2022-01-16 16:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-16 14:46 Mark Hansen
2022-01-16 16:12 ` Adam Dinwoodie [this message]
2022-01-16 16:35   ` Mark Hansen
2022-01-16 17:59     ` Eliot Moss
2022-01-26 14:37 ` Andrey Repin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220116161249.tvizujlenvqkdyyp@lucy.dinwoodie.org \
    --to=adam@dinwoodie.org \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).