← Back to team overview

ubuntu-accomplishments-contributors team mailing list archive

Re: reloading accomplishments for another user?

 

Install hooks should not be doing anything to user sessions.  I'm pretty
sure this will raise objections when we submit it to Universe.

Instead it might be better for the daemon to add an inotify watch on the
accomplishments directory, and reload itself when something is added or
removed.

Michael Hall
mhall119@xxxxxxxxxx

On 11/17/2012 01:25 PM, Matt Fischer wrote:
> 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
> 
> 
> 


Follow ups

References