If you want to take care about your users quota and your storage space, check this …
1. Create new file (for example quota_notify inside /usr/local/sbin/ )
2. Copy next content inside quota_notify
#!/usr/bin/perl -w # Author <jps@tntmax.com> # # This script assumes that virtual_mailbox_base in defined # in postfix's main.cf file. This directory is assumed to contain # directories which themselves contain your virtual user's maildirs. # For example: # # -----------/ # | # | # home/vmail/domains/ # | | # | | # example.com/ foo.com/ # | # | # ----------------- # | | | # | | | # user1/ user2/ user3/ # | # | # maildirsize # use strict; my $POSTFIX_CF = "/etc/postfix/main.cf"; my $MAILPROG = "/usr/sbin/sendmail -t"; my $WARNPERCENT = 80; my @POSTMASTERS = ('postmaster@mydomain.tld'); my $CONAME = 'Company ....'; my $COADDR = 'postmaster@mydomain.tld'; my $SUADDR = 'postmaster@mydomain.tld'; my $MAIL_REPORT = 1; my $MAIL_WARNING = 1; #get virtual mailbox base from postfix config open(PCF, "< $POSTFIX_CF") or die $!; my $mboxBase; while (<PCF>) { next unless /virtual_mailbox_base\s*=\s*(.*)\s*/; $mboxBase = $1; } close(PCF); #assume one level of subdirectories for domain names my @domains; opendir(DIR, $mboxBase) or die $!; while (defined(my $name = readdir(DIR))) { next if $name =~ /^\.\.?$/; #skip '.' and '..' next unless (-d "$mboxBase/$name"); push(@domains, $name); } closedir(DIR); #iterate through domains for username/maildirsize files my @users; chdir($mboxBase); foreach my $domain (@domains) { opendir(DIR, $domain) or die $!; while (defined(my $name = readdir(DIR))) { next if $name =~ /^\.\.?$/; #skip '.' and '..' next unless (-d "$domain/$name"); push(@users, {"$name\@$domain" => "$mboxBase/$domain/$name"}); } } closedir(DIR); #get user quotas and percent used my (%lusers, $report); foreach my $href (@users) { foreach my $user (keys %$href) { my $quotafile = "$href->{$user}/maildirsize"; next unless (-f $quotafile); open(QF, "< $quotafile") or die $!; my ($firstln, $quota, $used); while (<QF>) { my $line = $_; if (! $firstln) { $firstln = 1; die "Error: corrupt quotafile $quotafile" unless ($line =~ /^(\d+)S/); $quota = $1; last if (! $quota); next; } die "Error: corrupt quotafile $quotafile" unless ($line =~ /\s*(-?\d+)/); $used += $1; } close(QF); next if (! $used); my $percent = int($used / $quota * 100); $lusers{$user} = $percent unless not $percent; } } #send a report to the postmasters if ($MAIL_REPORT) { open(MAIL, "| $MAILPROG"); select(MAIL); map {print "To: $_\n"} @POSTMASTERS; print "From: $COADDR\n"; print "Subject: Daily Quota Report.\n"; print "DAILY QUOTA REPORT:\n\n"; print "----------------------------------------------\n"; print "| % USAGE | ACCOUNT NAME |\n"; print "----------------------------------------------\n"; foreach my $luser ( sort { $lusers{$b} <=> $lusers{$a} } keys %lusers ) { printf("| %3d | %32s |\n", $lusers{$luser}, $luser); print "---------------------------------------------\n"; } print "\n--\n"; print "$CONAME\n"; close(MAIL); } #email a warning to people over quota if ($MAIL_WARNING) { foreach my $luser (keys (%lusers)) { next unless $lusers{$luser} >= $WARNPERCENT; # skip those under quota open(MAIL, "| $MAILPROG"); select(MAIL); print "To: $luser\n"; map {print "BCC: $_\n"} @POSTMASTERS; print "From: $SUADDR\n"; print "Subject: WARNING: Your mailbox is $lusers{$luser}% full.\n"; print "Reply-to: $SUADDR\n"; print "Your mailbox: $luser is $lusers{$luser}% full.\n\n"; print "Please consider deleting e-mail and emptying your trash folder to clear some space.\n\n"; print "Contact <$SUADDR> for further assistance.\n\n"; print "Thank You.\n\n"; print "--\n"; print "$CONAME\n"; close(MAIL); } }
3. Edit next lines inside and set up your postmaster email address, percentage, etc
my $POSTFIX_CF = "/etc/postfix/main.cf"; my $MAILPROG = "/usr/sbin/sendmail -t"; my $WARNPERCENT = 80; my @POSTMASTERS = ('postmaster@mydomain.tld'); my $CONAME = 'Company ....'; my $COADDR = 'postmaster@mydomain.tld'; my $SUADDR = 'postmaster@mydomain.tld'; my $MAIL_REPORT = 1; my $MAIL_WARNING = 1;
4. set chmod 755 on quota_notify (# chmod 755 /usr/local/sbin/quota_notify)
5. add next line to crontab so it will be executed at 0:00 every day.
0 0 * * * /usr/local/sbin/quota_notify &> /dev/null
Keep in mind that this script has only reporting purpose and it will not reject any email when user mailbox is over quota. For this you will need Postfix with quota patch.
This post was inspired by this LINK.
I just want to share one link about processing millions of images. Here it is LINK
As most of us already know, PHP is one of the most popular scripting language for developing dynamic web pages. But you probably don’t know that PHP can be used as a shell scripting language. It isn’t robust as Bash or Perl but it has some advantages.
The only difference between a PHP shell script and a regular PHP file which serves web page is the first line:
#!/usr/bin/php -qThe ‘-q’ switch is here to suppress the HTTP headers. After the first line, you just add standard PHP tags:
<?php ?>
Here is the example so you can see what I’m talking about:
#!/usr/bin/php -q <?php print("Hi there folks !\n"); ?>
Save these lines as test.php and execute with:
# php test.php
Good idea is to add the next lines at the beginning:
if (!isset($_SERVER["argv"][0]) || isset($_SERVER['REQUEST_METHOD']) || isset($_SERVER['REMOTE_ADDR'])) { die ("<br><strong>Shell access only</strong>"); }
In this case, this script can be accessible via browser but those lines will kill the script in case if it is issued via browser.
To see what ports are open in your Linux box, you can use nmap port scanner or you can use netstat.
nmap can be used with following command:
# nmap -sS -O 127.0.0.1
The answer will be something like:
Starting Nmap 4.11 ( http://www.insecure.org/nmap/ ) at 2010-07-08 11:31 CEST Interesting ports on localhost.localdomain (127.0.0.1): Not shown: 1663 closed ports PORT STATE SERVICE 22/tcp open ssh 25/tcp open smtp 80/tcp open http 110/tcp open pop3 111/tcp open rpcbind 143/tcp open imap 993/tcp open imaps 995/tcp open pop3s 3306/tcp open mysql 8009/tcp open ajp13 8080/tcp open http-proxy 8443/tcp open https-alt No exact OS matches for host (If you know what OS is running on it, see http://www.insecure.org/cgi-bin/nmap-submit.cgi). ...... Uptime 15.472 days (since Wed Jun 23 00:12:46 2010) Nmap finished: 1 IP address (1 host up) scanned in 9.558 seconds
and nmap can be used to scan remote hosts (keep in mind that many admins will notice this as hack attempt). Simple replace 127.0.0.1 with host IP address.
Another way to check open ports is via netstat. Netstat can show hidden ports and programs associated with ports. Simple execute next command as root:
# netstat -nap
The output list can be very long (depending from your network activity).
Note: Use this tips carefully. I’m not responsible for any potential damage…
The MS Windows OS-es uses the AUTORUN.INF file from removable drives (USB, CD, DVD,…) in order to know which actions to perform when a new external storage device is inserted into the PC. This is good for movies, install CDs and other friendly “things” but unfortunately the malware uses the same way to attack your computer…
fsck is used to check and optionally repair one or more Linux file systems. File system can be a device name (e.g. /dev/sda2), a mount point (e.g. /, /usr,… ), or an ext2 label or UUID specifier. By default, the fsck will try to handle filesystems on different physical disk drives in parallel to reduce the total amount of time needed to check all of the filesystems.
MySQL Workbench is a cross-platform, visual database design tool developed by MySQL. It is the highly anticipated successor application of the DBDesigner4 project. MySQL Workbench will be available as a native GUI tool on Window, Linux and OS X.
MySQL Workbench 5.2 RC provides:
1. Data Modeling
2. Query (upgrade from MySQL Query Browser)
3. Admin (upgrade from MySQL Administrator)
Please get your copy from this page

MotoDev Studio for Android is Motorola’s integrated development environment based on Eclipse which forms complete development package. One installer ensures an integrated development environment with Eclipse 3.5 and Android Development Tools (ADT) plus automatic download and configuration of the latest Android SDK.
What is the worst, the most poorly designed, buggiest, prone-to-breakdown, driver-devouring, update-eluding, the worst piece of crap application you’ve ever see? It is hard to say, but lets be honest… Samsung PC Studio is the first candidate for this title…
amavisd-new is a high-performance and reliable interface between mailer (MTA) and one or more content checkers: virus scanners, and/or Mail::SpamAssassin Perl module. It is written in Perl, ensuring high reliability, portability and maintainability. It talks to MTA via (E)SMTP or LMTP protocols, or by using helper programs. No timing gaps exist in the design, which could cause a mail loss.
In other words, amavisd-new will help you to fight against spam. In this post, I won’t write about installation (coming soon in you theaters)
This post is just a small trick which will help you to release specific message from quarantine (false positive or you simple want to read spam messages)
Fist you need to find message inside the messages log file (usually /var/log/messages)
May 10 10:06:56 ns1 amavis[12774]: (12774-13) Blocked SPAM, [207.46.22.35] [207.46.22.35] <cnfrmpro@microsoft.com> -> <mymail@domain.tld>, quarantine: spam-1lvc624m6MVB.gz, Message-ID: <BY2MSFTVSMTP03Dfn8e0003d305@by2msftvsmtp03.phx.gbl>, mail_id: 1lvc624m6MVB, Hits: 7.743, size: 3013, 4325 ms
As you can see above, it is spam-1lvc624m6MVB.gz
Now you can release specific message with
[root@s1 ~]# amavisd-release spam-1lvc624m6MVB.gz
And you will see something like
250 2.0.0 Ok, id=rel-1lvc624m6MVB, from MTA([127.0.0.1]:10025): 250 2.0.0 Ok: queued as 403206AF07CE
Now you just need to check your inbox and you should see the message.