?
Solved

I need a script to test ps -ef |grep ssh-agent, then execute eval `ssh-agent` and  ssh-add if the process is not running

Posted on 2012-09-06
3
Medium Priority
?
740 Views
Last Modified: 2012-09-06
Hi experts.
I need a script to test ps -ef |grep ssh-agent, then execute eval `ssh-agent` and  ssh-add if the process is not running.

Ibm Aix 5.3.
0
Comment
Question by:LindaC
  • 2
3 Comments
 
LVL 68

Accepted Solution

by:
woolmilkporc earned 2000 total points
ID: 38372030
if ! ps -ef | grep -v grep | grep -q "ssh-agent" ; then
  eval $(ssh-agent)
  ssh-add # specify filename(s) here if required
fi
0
 
LVL 8

Author Comment

by:LindaC
ID: 38372034
Thanks, trying.
0
 
LVL 8

Author Closing Comment

by:LindaC
ID: 38372046
Thanks!
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Suggested Courses
Course of the Month15 days, left to enroll

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question