RE: Darned Scripting


Subject: RE: Darned Scripting
From: Brian ThunderEagle (furbs@mail.swjedi.net)
Date: Thu Dec 19 2002 - 02:48:25 AKST


Alright, that works. I can now restart my SSH server through SSH be running
this script:

#!/bin/sh
pid=`ps -ef | grep ssh | awk '{ if ( $3 == "1" ) print $2 }'`
kill $pid
/usr/local/sbin/sshd2 -p 22

Too bad I just broke one of my config files, and can't login now :(

     Brian ThunderEagle
      - http://www.swjedi.net
      - furbs@swjedi.net
      - bthundereagle@aidea.org

Quoting "Hassler, Jeff" <Jeff.Hassler@asc.asrc.com>:

>
> OK, the 'equals sign' after the pid is being changed to 3D, s/b an
> 'equals sign'.
>
> pid=3D`ps -ef | grep lsn | awk '{ if ( $3 =3D=3D "1" ) print $2 }'`
>
> -----Original Message-----
> From: Hassler, Jeff=20
> Sent: Thursday, December 19, 2002 2:19 PM
> To: aklug@aklug.org
> Subject: RE: Darned Scripting
>
>
> Sorry -- got changed somehow!
>
> pid=3D3D`ps -ef | grep lsn | awk '{ if ( $3 =3D3D=3D3D "1" ) print $2 =
> }'`
> -----Original Message-----
> From: Hassler, Jeff=3D20
> Sent: Thursday, December 19, 2002 2:18 PM
> To: aklug@aklug.org
> Subject: RE: Darned Scripting
>
>
> This returns a pid for a 'lsn' process. Just need to replace 'lsn' with
> whatever you are looking for that is unique.
>
> pid=3D3D3D`ps -ef | grep lsn | awk '{ if ( $3 =3D3D3D=3D3D3D "1" ) print =
> $2 =3D
> }'`
>
> -----Original Message-----
> From: Brian ThunderEagle [mailto:furbs@mail.swjedi.net]=3D3D20
> Sent: Thursday, December 19, 2002 2:13 AM
> To: aklug@aklug.org
> Subject: Darned Scripting
>
>
> I have a process:
> /var/run/sshd2_22.pid
> I need a script (Bash or Perl):
> Kill <process ID in /var/run/sshd2_22.pid>
> <restart the process> /usr/local/sbin/sshd2 -p 22
> I can get the PID:
> cat /var/run/sshd2_22.pid
> I cannot get the script to execute the Kill command on the PID. Because
> I=3D3D20
> cannot figure out how to set the PID as a variable, or combine the kill
> and cat=3D3D20
> commands together if that is possible. I would really appreciate any
> help on=3D3D20
> this.=3D3D20
>
>
>
> Brian ThunderEagle
> - http://www.swjedi.net
> - furbs@swjedi.net
> - bthundereagle@aidea.org
>
>
>
>
>
>
>
>
> -------------------------------------------------
> This mail sent through IMP: http://horde.org/imp/
>
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>
>
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>
>
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>
>
> ---------
> To unsubscribe, send email to <aklug-request@aklug.org>
> with 'unsubscribe' in the message body.
>

-------------------------------------------------
This mail sent through IMP: http://horde.org/imp/

---------
To unsubscribe, send email to <aklug-request@aklug.org>
with 'unsubscribe' in the message body.



This archive was generated by hypermail 2a23 : Thu Dec 19 2002 - 14:49:17 AKST