script to delete dovecot users
#
# deldovecotuser - for deleting virtual dovecot users
#
if [ ! $# = 1 ]
then
echo -e "Usage: $0 username@domain"
exit 1
else
user=`echo "$1" | cut -f1 -d "@"`
domain=`echo "$1" | cut -s -f2 -d "@"`
if [ -x $domain ]
then
echo -e "No domain given\nUsage: $0 username@domain: "
exit 2
fi
fi
read -n 1 -p "Delete user $user@$domain from dovecot? [Y/N]? " REPLY
echo
case $REPLY in
y | Y)
new_users=`grep -v $user@$domain /etc/dovecot-users`
new_passwd=`grep -v $user@$domain /etc/dovecot-passwd`
new_vmaps=`grep -v $user@$domain /etc/postfix/vmaps`
new_vhosts=`grep -v $domain /etc/postfix/vhosts`
echo "Deleting $user@$domain from /etc/dovecot/users"
echo "$new_users" > /etc/dovecot-users
echo "Deleting $user@$domain from /etc/dovecot-passwd"
echo "$new_passwd" > /etc/dovecot-passwd
echo "Deleting $user@$domain from /etc/postfix/vmaps"
echo "$new_vmaps" > /etc/postfix/vmaps
echo "Deleting $domain from /etc/postfix/vhosts"
echo "$new_vhosts" > /etc/postfix/vhosts
postmap /etc/postfix/vmaps
postfix reload
read -n1 -p "Delete all files in /home/vmail/$domain/$user? [Y/N]? " DELETE
echo
case $DELETE in
y | Y)
echo "Deleting files in /home/vmail/$domain/$user"
rm -fr /home/vmail/$domain/$user
rm -fr /home/vmail/$domain
;;
* )
echo "Not deleting files in /home/vmail/$domain/$user"
;;
esac
;;
* )
echo "Aborting..."
;;
esac
script to add dovecot user
if [ ! $# = 1 ]
then
echo "Usage: $0 username@domain"
exit 1
else
user=`echo "$1" | cut -f1 -d "@"`
domain=`echo "$1" | cut -s -f2 -d "@"`
if [ -x $domain ]
then
echo "No domain given\nUsage: $0 username@domain"
exit 2
fi
echo "Adding user $user@$domain to /etc/dovecot-users"
echo "$user@$domain::5000:5000::/home/vmail/$domain/$user/:/bin/false::"
>> /etc/dovecot-users
# Create the needed Maildir directories
echo "Creating user directory /home/vmail/$domain/$user"
# maildirmake.dovecot does only chown on user directory, we'll
create domain directory instead
if [ ! -x /home/vmail/$domain ]
then
mkdir /home/vmail/$domain
chown 5000:5000 /home/vmail/$domain
chmod 700 /home/vmail/$domain
fi
/usr/bin/maildirmake.dovecot /home/vmail/$domain/$user
chown 5000:5000 /home/vmail/$domain
chmod -R vmail:vmail /home/vmail/$domain
# To add user to Postfix virtual map file and relode Postfix
echo "Adding user to /etc/postfix/vmaps"
echo $1 $domain/$user/ >> /etc/postfix/vmaps
echo $domain >> /etc/postfix/vhosts
postmap /etc/postfix/vmaps
postfix reload
fi
echo "\nCreate a password for the new email user"
passwd=`dovecotpw`
echo "Adding password for $user@$domain to /etc/dovecot-passwd"
if [ ! -x /etc/dovecot-passwd ]
then
touch /etc/dovecot-passwd
chmod 640 /etc/dovecot-passwd
fi
echo "$user@$domain:$passwd" >> /etc/dovecot-passwd
/etc/init.d/dovecot restart
exit 0
wordpress : get all category names with the number of post in each category
each category for each month
"SELECT count(*), wp_terms.name FROM wp_term_taxonomy AS
wp_term_taxonomy INNER JOIN wp_terms ON wp_term_taxonomy.term_id =
wp_terms.term_id INNER JOIN wp_term_relationships ON
wp_term_taxonomy.term_taxonomy_id =
wp_term_relationships.term_taxonomy_id INNER JOIN wp_posts ON
wp_term_relationships.object_id = wp_posts.ID WHERE
wp_posts.post_status = 'publish' AND wp_posts.post_type = 'post' AND
wp_term_taxonomy.taxonomy = 'category' and wp_posts.post_date like
'2011-11' GROUP BY wp_terms.name
unix/shell scripting programming
• Experience in architecting and designing solutions for batch processing using shell scripting is required. Hands-on experience in writing and debugging shell scripts that invoke j2SE or J2EE modules for at least .
• Expert knowledge of utilities like SFTP, MAIL, SORT , etc in Linux environment.
• Demonstrate ability in reverse engineering existing scripts and redesign it for better performance
• Experience with version control tool like subversion, etc.
• Good knowledge of Oracle and DB2 database from an application perspective. This includes but not limited to SQLs, PL/SQL, Stored Procedures and application performance impacted by database access
-------------
C++ with Linux/Unix as a platform, SQL as a database and some sort of scripting knowledge i.e Perl/Shell/Python.