Showing posts with label DBmail. Show all posts
Showing posts with label DBmail. Show all posts

08 March 2008

My Little Shell Script

I have a script that I used for many years as a tools for migration, installation and configuration in Linux and FreeBSD. I love my little script. It will read my input file, count the number of lines, read the lines one by one, cut the line and put it into input that I want. Echo it back into template that I've define and loop and loop until end of the lines.

That's my little shell script.

Quote is my shell script is a migration script of vpopmail passwd file into Linux passwd/shadow format so I can run migration tools from padl nss_ldap to create LDIF format (PosixAccount) that suitable to be used with DBmail.

But, Bro root script much more simpler that this and one liner if it can be. Hehehe.



#!/bin/bash
NOUID=500
TOTALL=`wc -l $1 | awk '{print $1}'`
KIRA=1
while [ $KIRA -le $TOTALL ]
do
echo "$KIRA"
BARIS1=`head -$KIRA $1 | tail -1`
NAMAUSER=`echo $BARIS1 | cut -d: -f1`
KATALALUAN=`echo $BARIS1 | cut -d: -f2`
NAMAPENUH=`echo $BARIS1 | cut -d: -f5`
NOUID=`expr $NOUID + 1`
#
### rpm:x:37:37::/var/lib/rpm:/sbin/nologin
echo "$NAMAUSER:x:$NOUID:12:$NAMAPENUH:/home/$NAMAUSER:/sbin/nologin" >> password$$.txt
echo "$NAMAUSER:$KATALALUAN:13941:0:99999:7:::" >> shadow$$.txt
#dbmail-users -v -a $NAMAUSER -wlaluan123 -p md5-base64 -m 100M -s $BARIS1
#
KIRA=`expr $KIRA + 1`
done
exit


Google

My Blog List