[systemd-devel] Help writing a user service file that will exec a command upon system sleep

John da_audiophile at yahoo.com
Thu Oct 29 13:51:53 PDT 2015





----- Original Message -----
> From: Simon McVittie <simon.mcvittie at collabora.co.uk>
> To: systemd-devel at lists.freedesktop.org
> Cc: 
> Sent: Thursday, October 29, 2015 3:27 PM
> Subject: Re: [systemd-devel] Help writing a user service file that will exec a command upon system sleep
> 
> On 29/10/15 18:52, John wrote:
>>  This is an interesting idea but I would like to learn about user units and 
> sleep mode :)
> 
> I think the intention is that per-user code deals with sleep by having a
> service (daemon) that registers to inhibit suspend; when it is notified
> that systemd would like to suspend, it does what it needs to do, then
> releases the inhibit to allow suspend to continue.
> 
> Here's a working implementation (it also handles two flavours of network
> connectivity, but you can ignore those bits), which Telepathy uses to
> try to log out from IM services before suspending:
> http://cgit.freedesktop.org/telepathy/telepathy-mission-control/tree/src/connectivity-monitor.c


Hello Simon.  Thank you for the post.  I am not a programmer and cannot really read the code you referenced.  Can you point me to a particular line number or line numbers?  Since my tool is a bash script, I'm looking to distill out if possible the relevant sections and adapt to this use case.  Thank you.


More information about the systemd-devel mailing list