On Sunday 23 July 2006 13:18, Mick wrote:
> I checked the script I have in my /etc/X11/Sessions/fluxbox:
> ==============================
> eval "$(gpg-agent --daemon)"
> /usr/bin/startfluxbox
> kill `echo ${GPG_AGENT_INFO} | cut -d ':' -f 2`
> ==============================
>
> Running these separately after I kill gpg-agent *and* empty the /tmp/gpg-*
> entities gives me the following semi-illuminating response:
>
> $ eval "$(gpg-agent --daemon)"
> can't connect to `/home/michael/.gnupg/log-socket': Connection refused
>
> Why does this happen?  A new ENV variable has been created alright in the
> /tmp dir:
>
> $ echo ${GPG_AGENT_INFO}
> /tmp/gpg-0UQfJ1/S.gpg-agent:11772:1
>
> I think that the kill `echo ${GPG_AGENT_INFO} | cut -d ':' -f 2` line in my
> fluxbox start up script kills the gpg-agent process but does not seem to
> flush the ENV variable, hence all this cruft accumulates in /tmp.
>
> Does anyone else have this problem?

Apparently gpg-agent does clean up properly after it when it is killed. I have 
just changed my gpg-agent.sh shutdown script as shown below. The rm and rmdir 
lines should make it clean up nicely after it.

$ cat ~/.kde/shutdown/gpg-agent.sh
#!/bin/sh
# the second field of the GPG_AGENT_INFO variable is the
# process ID of the gpg-agent active in the current session
# so we'll just kill that, rather than all of them :)
if [[ -n ${GPG_AGENT_INFO} ]]; then
        kill $(echo ${GPG_AGENT_INFO} | cut -d ':' -f 2)
        rm $(echo ${GPG_AGENT_INFO} | cut -d ':' -f 1)
        rmdir $(dirname `echo ${GPG_AGENT_INFO} | cut -d ':' -f 1`)
        unset GPG_AGENT_INFO
fi

-- 
Bo Andresen

Attachment: pgpV1soYToWq4.pgp
Description: PGP signature

Reply via email to