[systemd-devel] systemd reboot problem

2017-03-06 Thread lin webber
I use “system("reboot")” in my C program and system does not shutdown.I think 
that systemd is waiting for some services to shutdown which can't shutdown 
immediately.
But I don't want to wait for those services to shutdown.How can I shutdown my 
system immediately in my C program.which API should I call?
Thank you for reply.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Can a systemd --user instance rely on After= of systemd --system instance?

2017-03-06 Thread Kai Krakow
Am Sat, 4 Mar 2017 22:07:57 +0300
schrieb Andrei Borzenkov :

> 04.03.2017 13:49, Peter Hoeg пишет:
> > Hi,
> >   
> >> If I have a user service which needs to have the system database
> >> server available: How do I construct a proper depend?  
> > 
> > As Lennart was pointing out, the user and system instances do not
> > know anything about each other, so you cannot.
> >   
> 
> "You cannot because it is currently unimplemented", "you cannot
> because we do not care but feel free to implement" or "you cannot
> because we will never even consider it"?
> 
> > The 2 other options I can think of:
> > 
> > a) Run a system service specifying your user id in User=
> >   
> 
> The problem has nothing to do with ownership so it won't help.

I'm running it in the user context for different reasons. I don't think
that setting the UID is the same. Additionally, I want users to be able
to restart their services during deployments.

> > b) Enable socket activation (if possible) on the system instance
> > database. That way your user instance will simply wait on the socket
> > until the server comes up.
> >   
> 
> This means you need to set absurdly large TimeoutStart because you
> have no idea when other service appears, so every time you attempt to
> start service you will need to wait absurdly large time before
> proceeding with error handling. Proper service dependency won't even
> attempt to start dependent service until dependencies are known to
> run.

Yes, and setting such TimeoutStart values is not meant to be the fix,
I'm sure. The database service here takes 2-3 minutes to fully start
and be ready. This is due to high IO load during startup but also due
to fully checking the database from the service ExecPost.

> systemd already propagates some unit types (devices, mounts and swaps)
> from system to user instance. Are there any fundamental problems that
> prevent doing it for other types?

I'd imagine something like Requires=system/mysqld.service to prefix the
dependency to the system instance.


-- 
Regards,
Kai

Replies to list-only preferred.


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel