#!/bin/sh # # /etc/init.d/ssh-agent # # startupfile for ssh-agent daemon # Start/stop processes required for start/stop ssh-agent # # created: GR 07-DEC-2001 # updated: SB 27-NOV-2001 and 13-FEB-2002 # generalised with variables at the top, comments # # ln -s /etc/init.d/ssh-agent /etc/rc3.d/S99ssh-agent # ln -s /etc/init.d/ssh-agent /etc/rc2.d/K99ssh-agent # ######## recipients="root" #agent="/opt/local/bin/ssh-agent" #agent="/opt/openssh/bin/ssh-agent" agent="/opt/OBSDssh/bin/ssh-agent" trust_user="root" agent_f="/tmp/ssh-agent.info" case "$1" in 'start') if [ -f ${agent_f} ]; then echo Sorry, it appears to exist an ssh-agent already running echo check ${agent_f} exit 1 fi if [ -x ${agent} ]; then echo starting secure shell agent daemon su $trust_user -c ${agent} > ${agent_f} echo "You need to run ssh-add as $trust_user!" | /usr/bin/mailx -s "`uname -n`: $agent daemon restarted" $recipients else echo "WARNING: ${agent} daemon file not found => ssh-agent did not start" fi ;; 'stop') echo shutting down ssh agent daemon if [ -f ${agent_f} ]; then . ${agent_f} ${agent} -k /usr/bin/rm -f ${agent_f} else echo could not read ${agent_f}. ssh-agent not stopped fi ;; *) echo "Usage: /etc/init.d.local/$0 { start | stop }" ;; esac