← Back to team overview

ubuntu-accomplishments-contributors team mailing list archive

Re: reloading accomplishments for another user?

 

Keep in mind that because we're moving DBus the launcher's behavior
may significantly change soon.

If the issue is with looking for PID file, how about explicitly
setting HOME envvar?

On the other hand, the message you're seeing ("The daemon is not
running.") would not be displayed if the daemon responded to a DBus
call launcher uses to determine if it's running. The pidfile is
checked only in case the daemon is not visible via DBus.

I remember that back in times when we wanted the daemon to use a
single instance for all users, we had some huge amount of code which
was meant to set properly some environmental variable that specified
which DBus bus will be used. It was extracted from envvars of running
gnome-sessions... I am afraid it can get even that tricky to use the
right user's DBus.

2012/11/17 Matt Fischer <matthew.fischer@xxxxxxxxxxxxx>:
> When an accomplishments collection is added or removed, we need to send the
> reload signal to all instances of the daemon.  I have code in the
> postrm/postinst steps that does this finally (below), but sudo -u {$user}
> just isn't enough due to the way the daemon looks for the PID file, I think.
> I considered modifying the daemon to accept a --user argument, but due to
> the way we look up the cache directory, I'm not sure that helps either.  The
> brief question is: using sudo, how can I call
> /usr/bin/accomplishments-daemon --reload for another user.  If you can solve
> that I have the rest of this issue solved.
>
> Here's the postinst/postrm code that will go into the collections and the
> output follows:
>
> #!/bin/sh -e
>
> if [ -x /usr/bin/accomplishments-daemon ];
> then
>     for user in `ps -ef | grep /usr/bin/accomplishments-daemon | grep
> /usr/bin/python | grep -v grep | awk '{ print $1 }'`; do
>         echo "Reloading accomplishments for ${user}"
>         sudo -u ${user} /usr/bin/accomplishments-daemon --reload
>     done
> fi
>
>
> Unpacking replacement ubuntu-community-accomplishments ...
> Reloading accomplishments for mfisch
> mfisch: /home/mfisch/.cache/accomplishments
> The daemon is not running.
> Reloading accomplishments for fred
> mfisch: /home/mfisch/.cache/accomplishments
> The daemon is not running.
> Setting up ubuntu-community-accomplishments (0.3~quantal2) ...
> Reloading accomplishments for mfisch
> mfisch: /home/mfisch/.cache/accomplishments
> The daemon is not running.
> Reloading accomplishments for fred
> mfisch: /home/mfisch/.cache/accomplishments
> The daemon is not running.
>
>
> This is the bug:
> https://bugs.launchpad.net/ubuntu-accomplishments-daemon/+bug/1049846
>
> --
>
> Matthew (Matt) Fischer
> LP: http://launchpad.net/~mfisch
> IRC: mfisch
>
>
> --
> Mailing list: https://launchpad.net/~ubuntu-accomplishments-contributors
> Post to     : ubuntu-accomplishments-contributors@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~ubuntu-accomplishments-contributors
> More help   : https://help.launchpad.net/ListHelp
>


References