From owner-freebsd-questions@freebsd.org Sun Jan 14 03:02:24 2018 Return-Path: Delivered-To: freebsd-questions@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D1BFE72941 for ; Sun, 14 Jan 2018 03:02:24 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mout.kundenserver.de (mout.kundenserver.de [217.72.192.74]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.kundenserver.de", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id ED50E2E6E for ; Sun, 14 Jan 2018 03:02:23 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from r56.edvax.de ([92.195.18.98]) by mrelayeu.kundenserver.de (mreue103 [212.227.15.183]) with ESMTPA (Nemesis) id 0MYcc6-1eMnBd1IPa-00VMEY; Sun, 14 Jan 2018 04:02:15 +0100 Date: Sun, 14 Jan 2018 04:02:15 +0100 From: Polytropon To: blubee blubeeme Cc: FreeBSD Subject: Re: devd.conf and $USER Message-Id: <20180114040215.95ba04bc.freebsd@edvax.de> In-Reply-To: References: Reply-To: Polytropon Organization: EDVAX X-Mailer: Sylpheed 3.1.1 (GTK+ 2.24.5; i386-portbld-freebsd8.2) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:lD1rtF5xKqzeQafWO6EA3vL0jcKaqeh50mJ+ENkd/IP51IvF5qS u03lPMFHoxo2Nbh3sQYAODDUZsQGBG+JeRpWawnl+4zYk5Z9Fn3Uk5JW7gqC6WJPhOCQir1 4KkoyD77UZKo78q05iR+dM5t3ayOjpBvSoO90olnbARg8oRgTqfrbFnThZb8zvkxn4WHazc kIhKuWZYbXkIJN0Ti3ykQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:jfePcC5KnpI=:/er0KaEt3cp4yZxp7sJ9vr p27i15q+qDWPWtd9Dn4REauLB7HZe6da+KezMyPELmJM/SH4wzWPMNeQc0SnV978H8quuVAF9 W5/nKvYZJH/Ip26epZkCtXKOKHKJS+m0Yzr9hXHWAEZwcOY9b7woXYTxdddc8GS0Zz7oZQxos wIvkQsYB3zaqXP00qB9TgU0yp56SjDTUF1GUw0VvHcvYG9b6lycAFiGdg7gBnj51pq8nkiBYV Ig00oF8efOfgIh+K+uownBPTTTgoZql4DXtgLB15WlyxKGrnwj8cTI6t21/bcLWMxug9W5B0J X25prFrxXBl0zcn/iVY1AUtv/uAy5QbSSATrpbZKt7Dr7pP9voKs1BBnXNeMtV6spQjYxbP+E sKjVK9ElRdb4XQwzt8eowPLxUs5WPm/nYo6uwayYncSVFoj+obM5aw2x7ftbi9YAxBMFq7yHJ aA5nWH3uCAJEPHBW/1ovE4KzaOqSsSSzb0xJBKkRB/+TIE0hLGEP/q2wqPG/w0HI9IZQKM6M4 imwotFa9eW9bvGZ1Esa03bvXT2SyzJB7oT/YPFxCBZcqye5rmJcbjgy9mhKBLZ9Zg35ew9Fcv 2E8/hFRSBe/0A0iN/Xk1u8m2WPJLZ3WhhW5qZkW8Dj/5pFbVVDccNs85DTrvg+RbiCWE4Z/L/ ZXvje3bI/l6XLZAe2APgo1rnd//ZNm3NEJgiwksG0sQLkalkkjL7ignhFkNX1p33uffkLea2L hrn1GyvwaNi2eFXb4FFNaYVIC8tyW2LgKAHr/x2kMnh6viqbzbKtMA4lHEA= X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 14 Jan 2018 03:02:24 -0000 On Sun, 14 Jan 2018 09:30:47 +0800, blubee blubeeme wrote: > Is there a way to pass the $USER env variable to an action initiated by > devd? What should this variable contain? In case of FreeBSD (and UNIX in general), multi-user systems allow that 0, 1, or 100+ users are logged in at the same time. As devd handles dynamic device configuration at root level, other user accounts active on the system don't matter. However, it is easy to let devd branch to a custom script that checks, for example, if a specific user is currently logged in, and if it is, performs a user-specific action. In this case, the corresponding logic needs to be implemented in that script, as devd has no access to if a specific user is logged in at the time a certain action needs to be performed (except, of course, it is hardcoded into its configuration file, but in my opinion, it's much easier and more convenient to put that logic into an external script). Many years ago, I needed exact that solution to make a crappy printer work. Upon attaching the printer, the system checked if the only user who was permitted to use that particular printer was currently logged in, and if he was, started certain programs first as root, then from that user account, created some specific files in the user's directory, and finally, after some delay, used xmessage to show the user a message that the printer was now available. As you can see, it was a _very_ crappy printer which needed all this terrible stuff. ;-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...