Sponsored Content
Full Discussion: Expired user alert
Top Forums Shell Programming and Scripting Expired user alert Post 302596285 by knight_eon on Tuesday 7th of February 2012 04:52:34 AM
Old 02-07-2012
Quote:
Originally Posted by michlix
the error is
Code:
./scriptalertpasswd.sh[7]: echo(7257600 - 691200):  not found.
syntax error on line 1 stdin
./scriptalertpasswd.sh[16]: test: 0403-021 A ] character is missing.
syntax error on line 1 stdin
./scriptalertpasswd.sh[16]: test: 0403-021 A ] character is missing.
syntax error on line 1 stdin
./scriptalertpasswd.sh[16]: test: 0403-021 A ] character is missing.

Are you trying to compute the difference in alertperiod=`echo"($changeperiod - $remindperiod)"`
If that is the case:

Code:
# changeperiod=7257600
# remindperiod=691200
# alertperiod=`echo"($changeperiod - $remindperiod)"`
-bash: echo(7257600 - 691200): command not found
# alertperiod=$((changeperiod - $remindperiod))
# echo $alertperiod
6566400

Secondly, your construct:
Code:
expireddate=`echo "$changeperiode + $lastupdate" | bc`

Can you see the extra e that is in bold appended to changeperiod variable? That is causing the pain Smilie

Hence the error:

Code:
 
scriptalertpasswd.sh[16]: test: 0403-021 A ] character is missing.
syntax error on line 1 stdin
./scriptalertpasswd.sh[16]: test: 0403-021 A ] character is missing.

Make the code like this:

Code:
 
#!/bin/ksh
# Script for check whose password will expire in 8 days
#
currentdate=`perl -le 'print time'`
changeperiod=$((84*86400))
remindperiod=$((8*86400))
alertperiod=$((changeperiod - remindperiod))
lastchange=`awk '/:/ {name=$1} ; /lastu/ {print name $3}' /etc/security/passwd`
for user in $lastchange
do
username=`echo $user | cut -f 1 -d:`
lastupdate=`echo $user | cut -f 2 -d:`
alertdate=$((alertperiod + lastupdate)) #" | bc`
expireddate=$((changeperiod + lastupdate)) #" | bc`
  if [$alertdate -le $currentdate]; then
      echo $username " "`perl -le "print scalar localtime ($expireddate)"` > /home/user3/expireduser.txt
  fi
done

 

6 More Discussions You Might Find Interesting

1. Cybersecurity

Sending a message to a user when password will be expired

Hi, Does anyone have a script (for AIX) that sends a message to a user that his password will be expired within 5 days for ex. Thanks (1 Reply)
Discussion started by: Diederd
1 Replies

2. AIX

HMC User account expired - What now?

I've created an hmc user account for our developers and set a pawword expiry to 30 days. Trouble is when the password expires they are asked to change it in the WebSM gui but it returns an error "XXXX check log file /var/websm/data/....log" which doesn't exist. I've tried resetting the password... (0 Replies)
Discussion started by: backslash
0 Replies

3. UNIX for Dummies Questions & Answers

How to reactivate expired account in Linux as a root user

I am an administrator of a Red Hat Enterprise Linux system. Now one account expired. I wonder how to reactivate the account. Thanks (2 Replies)
Discussion started by: cy163
2 Replies

4. Solaris

user expired

dear all iam trying to make user expire and it not suceeded with me iam trying useradd -e and it not succeeded (2 Replies)
Discussion started by: murad.jaber
2 Replies

5. Shell Programming and Scripting

Finding AIX user accounts expired or locked

// AIX 6.1 In need of finding which AIX user accounts will be expired and are locked. I have placed the following parameters under /etc/security/user... (1 Reply)
Discussion started by: Daniel Gate
1 Replies

6. Solaris

Solaris 11 user account login expired

Hi everyone Please i need urgent help... I have installed solaris 11 using live media.. then i installed sunray.. every thing is fine.. but after system reboot i am unable to login on server on GUI it gives account expired error or some time authentication failed... but i can log in through... (11 Replies)
Discussion started by: amk
11 Replies
Locale::Script(3perl)					 Perl Programmers Reference Guide				     Locale::Script(3perl)

NAME
Locale::Script - standard codes for script identification SYNOPSIS
use Locale::Script; $script = code2script('phnx'); # 'Phoenician' $code = script2code('Phoenician'); # 'Phnx' $code = script2code('Phoenician', LOCALE_CODE_NUMERIC); # 115 @codes = all_script_codes(); @scripts = all_script_names(); DESCRIPTION
The "Locale::Script" module provides access to standards codes used for identifying scripts, such as those defined in ISO 15924. Most of the routines take an optional additional argument which specifies the code set to use. If not specified, the default ISO 15924 four-letter codes will be used. SUPPORTED CODE SETS
There are several different code sets you can use for identifying scripts. The ones currently supported are: alpha This is a set of four-letter (capitalized) codes from ISO 15924 such as 'Phnx' for Phoenician. This code set is identified with the symbol "LOCALE_SCRIPT_ALPHA". The Zxxx, Zyyy, and Zzzz codes are not used. This is the default code set. numeric This is a set of three-digit numeric codes from ISO 15924 such as 115 for Phoenician. This code set is identified with the symbol "LOCALE_SCRIPT_NUMERIC". ROUTINES
code2script ( CODE [,CODESET] ) script2code ( NAME [,CODESET] ) script_code2code ( CODE ,CODESET ,CODESET2 ) all_script_codes ( [CODESET] ) all_script_names ( [CODESET] ) Locale::Script::rename_script ( CODE ,NEW_NAME [,CODESET] ) Locale::Script::add_script ( CODE ,NAME [,CODESET] ) Locale::Script::delete_script ( CODE [,CODESET] ) Locale::Script::add_script_alias ( NAME ,NEW_NAME ) Locale::Script::delete_script_alias ( NAME ) Locale::Script::rename_script_code ( CODE ,NEW_CODE [,CODESET] ) Locale::Script::add_script_code_alias ( CODE ,NEW_CODE [,CODESET] ) Locale::Script::delete_script_code_alias ( CODE [,CODESET] ) These routines are all documented in the Locale::Codes man page. SEE ALSO
Locale::Codes Locale::Constants http://www.unicode.org/iso15924/ Home page for ISO 15924. AUTHOR
See Locale::Codes for full author history. Currently maintained by Sullivan Beck (sbeck@cpan.org). COPYRIGHT
Copyright (c) 1997-2001 Canon Research Centre Europe (CRE). Copyright (c) 2001-2010 Neil Bowers Copyright (c) 2010-2011 Sullivan Beck This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2011-09-26 Locale::Script(3perl)
All times are GMT -4. The time now is 12:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy