Operating System - HP-UX
1752516 Members
5196 Online
108788 Solutions
New Discussion юеВ

password aging script in trusted systems

 
Sri123
Advisor

password aging script in trusted systems

Hi,

I just got this script in one of the threads, for password expiry notification.

I would like to know what current_time has to be set, as i am getting error in my script.


USER=someusername
exp=$(logins -x -l $USER | tail -1 | awk '{print $4}')
((exp_time = exp * 86400))
last_change=$(grep u_succhg /tcb/files/auth/$U/$USER | \
awk -F "u_succhg#" ' {print $2}' |\
awk -F ":" ' {print $1}' )

((exp_date = last_change + exp_time))
((time_left = exp_date - current_time))
((days_left = time_left / 86400))



Script returns,

ofadr-6CPU@DB>./passwdexp1.sh
./passwdexp1.sh[24]: 15:09:03: Syntax error

Attached is the actual script that i run.
6 REPLIES 6
Jose Mosquera
Honored Contributor

Re: password aging script in trusted systems

Hi,

Looks like an aritmetic operator is trying to use the "15:09:03" value. Try execute it again ussing the trace option, is useful to debug:
ofadr-6CPU@DB>sh -x passwdexp1.sh

Waiting for your next post.

Rgds.
Sri123
Advisor

Re: password aging script in trusted systems


Attached is the output. Looks like a same error.

Jose Mosquera
Honored Contributor

Re: password aging script in trusted systems

Before the IF statement show the value of $days_left variable (echo $days_left).

Also suggest you an echo of all variables belonging at formulas previous the IF.

Then run it again with debug option.

Rgds.
Jose Mosquera
Honored Contributor

Re: password aging script in trusted systems

Hi,

Previous post is just for debuging...
Sri123
Advisor

Re: password aging script in trusted systems


Figured it out!! Attached is the script which works fine, but it requires perl to be installed in the system.
Sri123
Advisor

Re: password aging script in trusted systems

Thanks!!