accf_http and incqlen

2008-03-05 Thread Scott Oertel
I setup the http accept filter with apache and I was having a hard time
understanding this, maybe you guys could help out.

I've tested this among various version of freebsd, and with various
apache configs, and it appears to behave the same across the board.

So why is it that it appears that the TCP connections never terminate,
just stay in a state of ESTABLISHED, and why doesn't this queue ever
flush itself, is it normal, if it is, what happens exactly when the
queue fills up to maxqlen. From the netstat output below, you can see
that the incqlen is maxed out. I've done quite a bit of searching
regarding this queue but haven't found any real solid information which
describes what happens when it fills up, and at the same time this is
going on, I have 517 established connections to port 80.

]# netstat -an|grep \.80|grep ESTAB|wc -l
 519


]# netstat -Lan

Current listen queue sizes (qlen/incqlen/maxqlen)
Proto Listen Local Address
tcp4  0/0/5  *.8080
tcp4  0/510/511  *.80
tcp4  0/0/10 *.587
tcp4  0/0/10 *.25
tcp4  0/0/128*.22
tcp4  0/0/100*.3306
tcp4  0/0/9  *.21
tcp4  0/0/128127.0.0.1.953
tcp4  0/0/3  127.0.0.1.53


-Scott Oertel

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: CPU utilization

2007-09-13 Thread Scott Oertel
Preethi Natarajan wrote:
 Hello,

 Is there a tool similar to mpstat (or mpstat itself) available to
 track CPU utilization on FreeBSD? I am looking for something more
 elaborate than top, and was wondering if anyone could help.

 Thanks,

Have you used vmstat? there are a lot of pages that reveal important
information in regards to the status of a system.


-Scott Oertel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: CPU utilization

2007-09-13 Thread Scott Oertel
Preethi Natarajan wrote:
 Hello,

 Is there a tool similar to mpstat (or mpstat itself) available to
 track CPU utilization on FreeBSD? I am looking for something more
 elaborate than top, and was wondering if anyone could help.

 Thanks,

I forgot also to mention systat, personally to keep track of CPU
utilization, as in graphs, I use cacti which queries the servers using
snmp, we also have a script which collects data from vmstat and stores
it into a rrd, then we use rrdcgi to make pretty graphs with the data.


-Scott Oertel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: awk question

2007-03-06 Thread Scott Oertel

Gary Kline wrote:

Guys,

Having found $9 , how do I /bin/rm it (using system()--yes??)
in an awk one-liner?

I'm trying to remove from packages from long ago and find and
print them with

ls -lt | awk '{if ($8 == 2006) print $9}';

but what I want to remove the file pointed at by $9.  I've tried
FILE=ARGV[9]; and using FILE within my system() call, but no-joy.
What's the magic here?

thanks in advance,

gary



  


Another way is:

ls -lt | awk '{if ($8 == 2006) print rm -rf $9}' | sh

but I agree, using pkg_delete would be safer:

ls -lt | awk '{if ($8 == 2006) print pkg_delete $9}' | sh

-SO
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: A webhosting script?

2006-08-25 Thread Scott Oertel
I wrote a simple one that could use improvement a while back for a 
FreeBSD box I had, you could use it as a reference point. It's developed 
in python though.


-Scott

Duane Hill wrote:

On Friday, August 25, 2006 at 3:45:08 PM, Kyrre confabulated:

  

At 17:30 25.08.2006, Andy Greenwood wrote:

We use perl scripts here. Unfortunately, I can't provide any 
specific examples.
  


  

So stop trolling :)



  

Perl is obsolete anyway, thanks though.



So, if Perl is obsolete, what does a guy use for a replacement?

  


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: A webhosting script?

2006-08-25 Thread Scott Oertel

For some reason the script doesn't really show up, ill just paste it here:

#!/usr/local/bin/python
#
# Site managment tool
# Written by: Scott Oertel
#


# imports
import os, sys, re, pwd
from crypt import crypt
import time, commands

global httpd_conf
httpd_conf = '/usr/local/etc/apache22/vhosts.conf'

class AddSite:
   def __init__(self, username, password, domain):
   self.username = username
   self.password = password
   self.domain = domain
   def run(self):
   self.AddUser()
   self.AddVhost()
   apacheStatus = 
commands.getstatusoutput('/usr/local/etc/rc.d/apache22.sh reload')

   if apacheStatus[0] != 0:
   print Apache reload failed!
   print apacheStatus[1]
   sys.exit()
  
   def losuj_salt (self, lenght = 8):

   '''Generate random salt from letters and digits. '''
   import random
   # pool for random bytes
   # pool = range (48, 127)
   pool = []
   for x in range (48, 127):
   pool.append (chr (x))
   s = [ '$1$' ] # start of salt indicating md5 encryption
   i = 0
   # check whether salt is between 0 and 8 (including both)
   if lenght  0:
   lenght = 0
   if lenght  8:
   lenght = 8
   # Generate up to 8 random, printable characters
   while i  lenght:
   s.append (s[i] + random.choice ( pool ))
   i += 1
   return s[lenght] + '$'
  
  
   def AddVhost(self):

   vhostDirective = '''
  
   ### vhost for #domain# ###
  
   VirtualHost *:80

   ServerAdmin [EMAIL PROTECTED]
   DocumentRoot #domainDir#
   ServerName #domain#
   ServerAlias www.#domain#
   ErrorLog /var/log/apache/#domain#-error_log
   CustomLog /var/log/apache/#domain#-access_log common
   SuexecUserGroup #user# #user#
   /VirtualHost
  
   ### end vhost for #domain# ###
  
   '''

   confObj = open(httpd_conf, 'a')
   os.mkdir(self.homeDir + /html, 0775)
   os.chown(self.homeDir + /html, pwd.getpwnam(self.username)[2], 
pwd.getpwnam(self.username)[3])

   vhostDirective = re.sub(#domain#, self.domain, vhostDirective)
   vhostDirective = re.sub(#domainDir#, self.homeDir + html, 
vhostDirective)

   vhostDirective = re.sub(#user#, self.username, vhostDirective)
   vhostObj = open(httpd_conf, 'a')
   vhostObj.write(vhostDirective)
  
   def AddUser(self):

 #check if site exists
 vhost_fileObj = open(httpd_conf, 'r')
 vhost_file = vhost_fileObj.read()
 try:
   pwd.getpwnam(self.username)
   sys.stderr.write(That username is already in use!\n)
   sys.exit()
 except KeyError:
   pass
 if re.search(r'[#]{3}[\s]+vhost\sfor\s(%s)[\s][#]{3}' % 
self.domain, vhost_file) != None:

   sys.stderr.write(That domain already has a vhost entry.\n)
   sys.exit()
 else:
   ## add the user/vhost ##
   # generate home directory
   name, tld = self.domain.split('.')
   self.homeDir = /home/ + tld + / + name + /
   hash = crypt(self.password, self.losuj_salt())
   tmpfile = open(/root/tmp/jsiIKw23, w)
   tmpfile.write(hash)
   tmpfile.close()
   # add the user
   groupStatus = commands.getstatusoutput(pw groupadd %s % self.username)
   pwStatus = commands.getstatusoutput(pw user add -n %s -G %s -d %s 
-s /bin/date -m -H 0  /root/tmp/jsiIKw23 % (self.username, 
self.username, self.homeDir))

   if groupStatus[0] != 0 or pwStatus[0] != 0:
   print User creation failed.
   print groupStatus
   print pwStatus
   sys.exit()
   # remove the temp file
   #os.remove(/tmp/jsiIKw23)
   # permissions setup
   try:
   os.chown(self.homeDir, pwd.getpwnam(self.username)[2], 
pwd.getpwnam(self.username)[3])

   except KeyError:
   print Setting folder permissions failed, trying again..,
   time.sleep(3)
   os.chown(self.homeDir, pwd.getpwnam(self.username)[2], 
pwd.getpwnam(self.username)[3])

   print Success!
  


class DeleteSite:
   def __init__(self, username, domain):
   self.username = username
   self.domain = domain
   def run(self):
   rmuserStatus = commands.getstatusoutput(/usr/sbin/rmuser -y %s % 
self.username)

   if rmuserStatus[0] != 0:
   print Ran into trouble deleting the username!
   print rmuserStatus[1]
   sys.exit(2)
   else:
   self.deleteVhost()
   apacheStatus = 
commands.getstatusoutput('/usr/local/etc/rc.d/apache22.sh reload')

   if apacheStatus[0] != 0:
   print Apache reload failed!
   print apacheStatus[1]
   sys.exit()
  
   def deleteVhost(self):

   vhostFile = open(httpd_conf, r)
   vhostFileData = vhostFile.read()
   vhostFileData = re.sub(r'[#]{3}[\s]+vhost\sfor\s(' + self.domain + 
')[\s][#]{3}[\n\t\n\t@A-Za-z\*\s0-9:\./\-_]+[#]{3}\send\svhost\sfor\s(' 
+ self.domain + ')\s[#]{3}[\n\t]+'

  , '', vhostFileData)
   vhostFile.close()
   vhostFile = open(httpd_conf, w)
   vhostFile.write(vhostFileData)
   vhostFile.close()
  
def usage():

   print '''Site Management Tool v1.0

Usage:

./site.py -a --user=username --pass=password --domain=domain
./site.py -d --user=username --domain=domain
./site.py -s --domain=domain

-s to suspend a site

Re: Midnight Commander in base distribution set

2006-08-04 Thread Scott Oertel

Bryan Bonifacio wrote:

The ports and packages are also available from the CD-ROMs (either the first or 
the second).

--
Bryan

Renat S. Nurgaliyev [EMAIL PROTECTED] wrote: Hello!

Please, please, please, include Midnight Commander into the future
releases of FreeBSD! It is extremely time-safing and lightweight tool. It can be
installed from ports, but what about disconnected PC's? Thanks a lot.

With Best Regards,
Renat S. Nurgaliyev
Data Network Engineer

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]

  
I use midnight commander on a daily basis, can anyone recommend a 
better, more lightweight tool then  mc?




-Scott Oertel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


removing large files (lost+found)

2006-08-02 Thread Scott Oertel
Yesterday after an fsck a file was placed in the lost+found folder which 
size was exactly the size of the drive (450gb). What is the safest way 
to remove this file?




Thanks,
Scott Oertel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: removing large files (lost+found)

2006-08-02 Thread Scott Oertel

Dan Nelson wrote:

In the last episode (Aug 02), Scott Oertel said:
  
Yesterday after an fsck a file was placed in the lost+found folder which 
size was exactly the size of the drive (450gb). What is the safest way 
to remove this file?



If its timestamp updates when you touch a file on the main filesystem,
it's most likely a snapshot file, either leftover from a failed
background fsck, or manually created by you with mksnap_ffs.  You can
just delete it.

  
The time stamp doesn't update, it gives an error: touch: #0005: 
Operation not permitted



-Scott Oertel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: removing large files (lost+found)

2006-08-02 Thread Scott Oertel

Dan Nelson wrote:

In the last episode (Aug 02), Scott Oertel said:
  

Dan Nelson wrote:


In the last episode (Aug 02), Scott Oertel said:
  

Yesterday after an fsck a file was placed in the lost+found folder
which size was exactly the size of the drive (450gb). What is the
safest way to remove this file?


If its timestamp updates when you touch a file on the main
filesystem, it's most likely a snapshot file, either leftover from a
failed background fsck, or manually created by you with mksnap_ffs. 
You can just delete it.
  

The time stamp doesn't update, it gives an error: touch: #0005:
Operation not permitted



I mean touch some other file :)

But I just remembered the correct way to determine if a file is a
snapshot: ls -lo.  If the flags field contains the word snapshot
for that file, it's a snapshot.

  
Good call, yeah.. it is a snap shot file, I suppose I'll try and remove 
it, hopefully removing a 450GB file doesn't lock up the system..

# ls -lo
-r  1 root   operator  snapshot 482801995408 Jul 31 
05:52 #0005


Thanks,
Scott Oertel
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: upgrade port, a couple of questions

2006-08-02 Thread Scott Oertel

Nicolas Blais wrote:

On Wednesday 02 August 2006 17:27, Efren Bravo wrote:
  

Hi,

How can I see which ports depend on
libgmp-4.1.4_1?

If I upgrade it, the applications that are using
the old libgmp would be affected?

Thanks...

Efren Bravo.



If you go into /var/db/pkg/libgmp-4.1.4_1 you'll see a file called 
+REQUIRED_BY. Read it (cat +REQUIRED_BY) to see which ports require libgmp.


You usually do not have to rebuild those ports unless there was a major change 
in the library. It's up to you to know if you need to rebuild them or not.


Nicolas.

  
This is a question i've had for a while, so this (+REQUIRED_BY) checks 
what depends on libgmp, how do you check what libgmp depends on?



Scott.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]