Restarting gpg-agent
Benjamin Donnachie
benjamin at py-soft.co.uk
Mon Mar 15 22:27:51 CET 2010
On 15 March 2010 16:54, Werner Koch <wk at gnupg.org> wrote:
> For years gpg-agent is able to test whether it is already
> running, just call gpg-agent and don't pass the --daemon option:
This is what I use the fall back as part of MacGPG2:
(* start-gpg-agent
Part of the MacGPG2 project - http://macgpg2.sourceforge.net
Released under v3 of the GPL
*)
-- Sleep for two seconds.
delay 2
-- Try to contact gpg-agent
set gpgAgentRunning to do shell script "/usr/local/bin/gpg-agent >&
/dev/null; echo $?; exit 0"
-- If that fails, look for env file.
if gpgAgentRunning > 0 then
set gpgAgentRunning to do shell script "[ -f $HOME/.gpg-agent-info ]
&& (source $HOME/.gpg-agent-info && export GPG_AGENT_INFO &&
/usr/local/bin/gpg-agent >& /dev/null) ; echo $?; exit 0"
end if
-- If that also fails, start a new copy of gpg-agent
if gpgAgentRunning > 0 then
do shell script "/usr/local/bin/gpg-agent --daemon
--use-standard-socket --write-env > /dev/null"
end if
Should be easy to understand and implement in another scripting language.
Ben
More information about the Gnupg-users
mailing list