Visit Jeremy's Blog.
Go Back > Forums > Non-*NIX Forums > Programming
User Name
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.


  Search this Thread
Old 01-12-2005, 09:04 AM   #1
LQ Newbie
Registered: Nov 2004
Distribution: Gentoo
Posts: 24

Rep: Reputation: 15
Wrapper needed for BASH Script

The comments have been made on what is needed, trying to figure out how to get this thing to be functional.
Min=7       # stops the users from changing their password for 7 days after a new password is set
Max=180     # 180 days after the password is set it expires
Warn=7      # 7 days warning about a password expiration
Inactive=60 # User account will expire 30 days after the password has expired

# On new systems:
if [ $NEWSYS ];then
        useradd -D -f $Inactive

# New users
if [ $NEWUSER ];then
        useradd -f $Inactive -c $GCOS $USER -k $SKEL_DIR
        passwd -n $Min -x $Max -w $Warn -i $Inactive $USER

# Force a password change by setting the last password changed date to 2000-01-01
# and the days between changes as 180
if [ $FORCE ];then
        DATE="2004-05-01" #need a routine that subtracts $Max + 1 days from today's date
        DATE=`./ $Max`;
        passwd -i $Inactive -x $Max $USER #prevents locking the account
        chage -d $DATE $USER #last password change
#!/usr/bin/perl -w
#Calculate the number of days in the past
#Does not account for Daylight savings time (I think)
use strict;

use POSIX qw/strftime/;

my $DaysFactor = 60 * 60 * 24;  #Number of seconds in  a day
my $Days = 0;
$Days = $ARGV[0] if $ARGV[0];
print strftime('%Y-%m-%d',localtime( time - ($DaysFactor * $Days)) );


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
help on shell script as a wrapper to launch default programs according to input file daveiro Programming 2 11-24-2005 04:20 PM
Bash script. help needed tazthecat Linux - General 2 09-30-2005 01:54 AM
bash script help needed Henster Linux - General 4 08-21-2005 09:54 AM
Bash: how to write a wrapper script? J_Szucs Programming 0 01-29-2005 05:50 PM
server wrapper script yapp Programming 2 08-02-2003 11:09 AM > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:03 AM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration