[tac_plus] TACACS+ Error socket issue.

ivo ivanlk3 at gmail.com
Thu Apr 12 12:24:38 UTC 2012


Hi Guys,

thanks for help and ideas really apreaciate it.
Here is the solution which helped to avoid  error message: Error
get_socket: bind xxxx Address already in use

when restarting tacacs process which is running on backround
example:
root 3543  /usr/local/bin/tac_plus -C /etc/tacacs+/SW4_tac_plus.conf
-l /var/log/tacacs/SW4_tac_plus.log -d 16 -p 5024

Algorithm:
1.add process_name
2. export pid of the process_name
3. gracefull kill of pid
4. wait 2 seconds
5. check if pid of process_name exist
6. if process name doesnt exist start again the same process
    else if process name still exist force kill of the process again
wait one second and start again the same process.

bash code:
########### RESTART ############
tac_process="/usr/local/bin/tac_plus -C /etc/tacacs+/SW4_tac_plus.conf
-l /var/log/tacacs/SW4_tac_plus.log -d 16 -p 5024
export tacpid_before=`ps aux | grep "$tac_process" | grep -v grep |
awk '{print $2}'`
         `kill -15 $tacpid`
         sleep 2
         export tacpid=`ps aux | grep "$tac_process" | grep -v grep |
awk '{print $2}'`

         if [ "$tacpid" == "" ];then
          echo 'Tacacs for '$name' with port:'$tacacs_port'
Pid:'$tacpid_before' stopped (first attempt)!'
          `$tac_process`
          export tacpid=`ps aux | grep "$tac_process" | grep -v grep |
awk '{print $2}'`
          echo 'Tacacs for '$name' with port:'$tacacs_port'
Pid:'$tacpid' started (first attempt)!'
          exit
         else
          `kill -9 $tacpid`
          sleep 1
          echo 'Tacacs for '$name' with port:'$tacacs_port'
Pid:'$tacpid_before' stopped (second attempt)!'
          `$tac_process`
          export tacpid=`ps aux | grep "$tac_process" | grep -v grep |
awk '{print $2}'`
          echo 'Tacacs for '$name' with port:'$tacacs_port'
Pid:'$tacpid' started (second attempt)!'
          exit
         fi

-----------------------------------------------------------------------------------------------------------
Dňa 30. marca 2012 0:28, heasley <heas at shrubbery.net> napísal/a:
> Thu, Mar 29, 2012 at 04:27:09PM -0600, Daniel Schmidt:
>> pgrep tac_plus will tell u if anything
>> survived
>
> and/or lsof for the specific port


Thu, Mar 29, 2012 at 07:37:34PM +0200, ivo:
> kill -9 <pid>
> /usr/local/bin/tac_plus -C /etc/tacacs+/R1_tac_plus.conf -l
> /var/log/tacacs/R1_tac_plus.log -d 16 -p 5000
>
> I recieve error into R1_tac_plus.log:
> Version F4.0.4.19 Initialized 1
> tac_plus server F4.0.4.19 starting
> Backgrounded
> Error get_socket: bind 5000 Address already in use

make sure that it has actually died.

pkill tac_plus

-----Original Message-----
From: tac_plus-bounces at shrubbery.net
[mailto:tac_plus-bounces at shrubbery.net] On Behalf Of ivo
Sent: Thursday, March 29, 2012 11:38 AM
To: tac_plus at shrubbery.net
Cc: trubela at gmail.com
Subject: [tac_plus] TACACS+ Error socket issue.

Hi Guys,

I need some help with starting and stoping tacacs.

I have several tacacs+ processes running on the backround linux red hat
enterprise server. Tacacs+ version which I use is F4.0.4.19.
The command which I use to start the tacacs processes are:
/usr/local/bin/tac_plus -C /etc/tacacs+/R1_tac_plus.conf -l
/var/log/tacacs/R1_tac_plus.log -d 16 -p 5000 /usr/local/bin/tac_plus -C
/etc/tacacs+/R2_tac_plus.conf -l /var/log/tacacs/R2_tac_plus.log -d 16 -p
5001 /usr/local/bin/tac_plus -C /etc/tacacs+/R3_tac_plus.conf -l
/var/log/tacacs/R3_tac_plus.log -d 16 -p 5002

when I run the tacacs it works fine.
But the problem is with stop of the tacacs. I am using to stop tacacs on
backround kill -9 <pid>

I am not familiar how start and stop of tacacs+ work.
Could me please somebody write a hint how to regular restart (stop and
start ) tacacs+ process from above backround processes ?
When i "restart" tacacs+ process :

kill -9 <pid>
/usr/local/bin/tac_plus -C /etc/tacacs+/R1_tac_plus.conf -l
/var/log/tacacs/R1_tac_plus.log -d 16 -p 5000

I recieve error into R1_tac_plus.log:
Version F4.0.4.19 Initialized 1
tac_plus server F4.0.4.19 starting
Backgrounded
Error get_socket: bind 5000 Address already in use

Do anybody know how to regular stop and start tacacs process?



-- 
http://www.gmail.com


More information about the tac_plus mailing list