Archive for May, 2007

Linux: Increasing the number of open file descriptors

Sunday, May 27th, 2007

To check and modify system limits.

[The current limit shown is 8192]
% cat /proc/sys/fs/file-max
8192

[To increase this to 65535 (as root)]
# echo "65535" > /proc/sys/fs/file-max

If you want this new value to survive across reboots you can at it to /etc/sysctl.conf

# Maximum number of open files permited
fs.file-max = 65535

Note: that this isn’t proc.sys.fs.file-max as one might expect. To list the available parameters that can be modified using sysctl do

% sysctl -a

To load new values from the sysctl.conf file.

% sysctl -p /etc/sysctl.conf

DON’T DELETE THIS MESSAGE — FOLDER INTERNAL DATA

Wednesday, May 16th, 2007

Yes, you can delete this message. This message is generated every time you use the webmail interface. Some technical information:
Webmail uses a protocol called IMAP to retrieve mail. Your Eudora, Outlook, etc. program at home is using POP3 to retrieve mail. The little postman working with IMAP generates that message everytime you go to webmail if it doesn\’t see it there, because it thinks it needs it. The little postman working for POP3 sees that email and thinks it\’s new mail so it download it. Get it? It\’s easy… every time you take that message away with POP3, the IMAP guy puts it back. Nothing we can do about this, we didn\’t invent the protocols.

Solution 1: Don\’t worry about it and delete it every time you see it.

Solution 2: If it really bothers you, 1. Stop using webmail. Not recommended if you are using the spam filters.

2. Setup your software at home to retrieve mail via IMAP instead of POP3

I personally use Solution 1.

How do I get a list of SQL Server tables and their row counts?

Tuesday, May 15th, 2007
SELECT
    [TableName] = so.name,
    [RowCount] = MAX(si.rows)
FROM
    sysobjects so,
    sysindexes si
WHERE
    so.xtype = 'U'
    AND
    si.id = OBJECT_ID(so.name)
GROUP BY
    so.name
ORDER BY
    2 DESC

-----------------------------
CREATE PROCEDURE dbo.listTableRowCounts 
AS 
BEGIN 
     SET NOCOUNT ON 

     DECLARE @SQL VARCHAR(255) 
     SET @SQL = 'DBCC UPDATEUSAGE (' + DB_NAME() + ')' 
     EXEC(@SQL) 

     CREATE TABLE #foo 
     ( 
          tablename VARCHAR(255), 
          rc INT 
     ) 

     INSERT #foo 
          EXEC sp_msForEachTable 
               'SELECT PARSENAME(''?'', 1), 
               COUNT(*) FROM ?' 

     SELECT tablename, rc 
          FROM #foo 
          ORDER BY rc DESC 

     DROP TABLE #foo 
END

Most common used taskqueue

Sunday, May 13th, 2007

Hello,

Update License:
action=update&value=license

Update DA:
action=update&value=program

While we’re at it, let’s do the rest

Nightly Tally:
action=tally&value=all

Tally one User:
action=tally&value=john&type=user

Tally a Reseller (and his users)
action=tally&value=joe&type=reseller

Check to turn on/off vacation messages:
action=vacation&value=all

Monthly Reset:
action=reset&value=all

Reset one User:
action=reset&value=john&type=user

Rewrite the user httpd.conf files with the templates
action=rewrite&value=httpd

Check the license to see if it needs updating and try to get a new one if it does:
action=check&value=license

Run a backup:
action=backup&id=1&owner=bob
(owner is the reseller)

Extra less important commands:

Recache the ‘Show all Users’ page:
action=cache&value=showallusers

Recache user bob in the ‘Show all Users’ page:
action=cache&value=showallusers&user=bob
action=cache&value=showallusers&select0=bob&select1=fred&…

Recache the safemode page:
action=cache&value=safemode

Recache domain.com on the safemode page:
action=cache&value=safemode&domain.com=user
action=cache&value=safemode&domain.com=user&domain2.com=user2

There are a few others that were created just for 1 time use during an update, but they’re reallly not too exciting

John

Re-generate DNS zone for DirectAdmin

Sunday, May 13th, 2007
echo "action=rewrite&value=named" >> /usr/local/directadmin/data/task.queue

QoS-Rate-Limiting Tip

Sunday, May 6th, 2007

this Artcle originated from: http://ciscotips.wordpress.com

QOS feature that performs rate-limiting and packet classification is called CAR-Committed Access Rate.

Here is a quick tip that limits an Internet based traffic
(primarily http and FTP) to 512K, with a nice, fat burst.

First create the access lists.

access-list 100 permit tcp any any eq www
access-list 100 permit tcp any any eq ftp

Then apply rate limiting rules to the appropriate interface:

interface Serial1/0
bandwidth 2048
ip address 172.16.100.2 255.255.255.252
rate-limit input access-group 100 512000 1024000 2048000 conform-action transmit exceed-action drop
rate-limit output access-group 100 512000 1024000 2048000 conform-action transmit exceed-action drop

It will limit only http and ftp trafic, for other corporate web applications running on different ports, it will still get full E1 bandwidth.

Warning:-If, in a rate-limit rule, you reference an access list that does not exist, the rule will match all traffic. Usually not good.