Restarting gpg-agent

Werner Koch wk at gnupg.org
Mon Mar 15 17:54:49 CET 2010


On Mon, 15 Mar 2010 11:58, roam at ringlet.net said:

>>     # start gpg-agent if no running instance is found
>>     if test -z "${GPG_AGENT_INFO}" ||
>>        ! kill -0 `grep GPG_AGENT_INFO ${GA_INFO_FILE} | cut -d: -f 2 -` 2>/dev/null; then
>
> In this way, you risk a false positive if gpg-agent has died (or not
> been started at all, but a .gpg-agent.info file has been left over)

I have not follewed this thread.  However the code above is far too
complex.  For years gpg-agent is able to test whether it is already
running, just call gpg-agent and don't pass the --daemon option:

  $ gpg-agent
  gpg-agent: gpg-agent running and available
  $ echo $?
  0
  $ GPG_AGENT_INFO= gpg-agent
  gpg-agent: no gpg-agent running in this session
  $ echo $?
  2



Shalom-Salam,

   Werner


-- 
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.




More information about the Gnupg-users mailing list