Perlmod is a program that will help you manage Perl Modules.

http://sourceforge.net/projects/perlmod/files/latest/download

A Perl module is a discrete component of software for the Perl
programming language. Technically, it is a particular set of
conventions for using Perl's package mechanism that has become
universally adopted.[discuss] A module defines its source code to be
in a package (much like a Java package), the Perl mechanism for
defining namespaces, e.g. CGI or Net::FTP or XML::Parser; the file
structure mirrors the namespace structure (e.g. the source code for
Net::FTP is in Net/FTP.pm). Furthermore, a module is the Perl
equivalent of the class when object-oriented programming is employed

Now we'll see an easy way to manage them, install, list, delete
(uninstall) from the command line.


Perlmod is a program that will help you manage Perl Modules.

script to delete dovecot users

#!/bin/bash
#
# 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

#!/bin/sh
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

a sql query to print all category names with the number of post in
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

Other Articles

Enter your email address: