ALT Linux sysadmins discussion
 help / color / mirror / Atom feed
From: Michael Shigorin <mike@osdn.org.ua>
To: sysadmins@lists.altlinux.org
Subject: [Sysadmins] [script] какие тянут файлы с ftp
Date: Thu, 18 Mar 2010 18:19:10 +0200
Message-ID: <20100318161910.GB9685@osdn.org.ua> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 505 bytes --]

	Здравствуйте.
В аттаче совсем быстрый наколенный хак для выяснения,
какому именно файлу, отдаваемому vsftpd, соответствует
видимый в iftop -BP порт сервера, болтающийся в топе.

Сделано для снижения расходов времени на спорадическое
любопытство, _не_ учитывает httpd/rsync, но вдруг кому
сгодится в качестве полезной отправной точки.

Принимает один аргумент (порт), запускается из-под sudo.

-- 
 ---- WBR, Michael Shigorin <mike@altlinux.ru>
  ------ Linux.Kiev http://www.linux.kiev.ua/

[-- Attachment #1.2: portfile --]
[-- Type: text/plain, Size: 262 bytes --]

#!/bin/sh
[ $# = 1 ] || exit 1

PID="$(netstat -pan | fgrep ":$1 " | sed -n 's,^.*ESTABLISHED \([0-9]\+\).*$,\1,p')"

# vsftpd behaviour hardwired, 
readlink /proc/$PID/fd/7

# or do like this:
#ls -l /proc/$PID/fd/* | fgrep /var/ftp | cut -f12- -d" "

[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]

                 reply	other threads:[~2010-03-18 16:19 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100318161910.GB9685@osdn.org.ua \
    --to=mike@osdn.org.ua \
    --cc=shigorin@gmail.com \
    --cc=sysadmins@lists.altlinux.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

ALT Linux sysadmins discussion

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sysadmins/0 sysadmins/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 sysadmins sysadmins/ http://lore.altlinux.org/sysadmins \
		sysadmins@lists.altlinux.org sysadmins@lists.altlinux.ru sysadmins@lists.altlinux.com
	public-inbox-index sysadmins

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sysadmins


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git