One liner with grep to extract the IP addresses from a file.
grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' /path/to/fileThe "-o" option prints only the matched parts.
One liner with perl:
perl -ne 'print if s/.*((\d{1,3}\.){3}\d{1,3}).*/\1/' /path/to/file
Extract IP addressSubmitted by sandip on Tue, 05/15/2012 - 15:22One liner with grep to extract the IP addresses from a file. grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' /path/to/fileThe "-o" option prints only the matched parts. One liner with perl: perl -ne 'print if s/.*((\d{1,3}\.){3}\d{1,3}).*/\1/' /path/to/fileFind size of ext3 JournalSubmitted by sandip on Fri, 04/13/2012 - 15:01The journal is located at inode: # tune2fs -l /dev/sda1 | awk '/Journal inode/ {print $3}'The size of journal in Bytes is: # debugfs -R "stat <inodenumber>" /dev/sda1 | awk '/Size: /{print $6}'|head -1Note: "<>" is necessary around the inode number. group writable web folders with setgid and ACLSubmitted by sandip on Tue, 04/03/2012 - 10:18Often times, there is need for web-accessible folders to be set up so all web-developers have write access. Along with setgid option, ACL can be used so anyone in the group "web-developers" So unless the acl privileges is revoked specifically, it would just continue to work. To enable ACL, add "acl" option to /etc/fstab file for the corresponding partition and remount. Edit /etc/fstab: /dev/mapper/home /home ext4 defaults,acl 0 2Remount: # mount -o remount /homeHere is the commands to be used for the setup: # groupadd developersNow anyone needing write access can be put in the "developers" group. # usermod -G developers {username}If you need the webserver to have write access to certain folders, then chown the location to be owned by the webserver, instead of giving write permissions to all. # chown apache /path/to/docroot/apacheGetting the most out of GrubSubmitted by sandip on Tue, 04/03/2012 - 07:40(via www.timburgess.net) The grub bootloader is particularly useful, especially when upgrading and testing new kernels. I recently found a way to modifiy the default boot config to make it useful when you wish to remotely upgrade a kernel and boot into it once only without being at the console to change the default back. munin-node mysql setupSubmitted by sandip on Wed, 03/28/2012 - 13:33
Install perl-Cache-Cache: # yum install munin-node perl-Cache-Cache[mysql*]mysql> create user munin@localhost identified by '{PASS}';munin-node-configure --suggest 2>/dev/null |grep mysql# cd /etc/munin/pluginsHow to install oracle java 7 in ubuntu 12.04Submitted by david23 on Tue, 03/27/2012 - 09:31(via www.ubuntugeek.com) Java is a programming language and computing platform first released by Sun Microsystems in 1995. It is the underlying technology that powers state-of-the-art programs including utilities, games, and business applications. Java runs on more than 850 million personal computers worldwide, and on billions of devices worldwide, including mobile and TV devices. Plesk courier-imap imapd on port 143 failsSubmitted by sandip on Thu, 02/16/2012 - 20:53After Plesk upgrade to 9.5.4, imapd on port 143 did not come up. On checking the maillog, it was complaining about: imapd: Invalid -maxprocsarg option.I noticed /etc/courier-imap/imapd had both the below lines commented: #MAXDAEMONS=40Once I uncommented those values, I was able to get the imap listener up upon a `service courier-imap restart`. Django postgresql connect_timeout via environment variableSubmitted by sandip on Mon, 02/06/2012 - 23:03Recently, I've had to move a postgresql database onto a separate server and split it out from the django application server. On doing so, we saw intermittent "OperationalError: could not connect to server: Connection timed out". This was quite obvious that the "connect_timeout" had to be increased to resolve the issue due to the latency introduced by the network. However, psycopg2 database adapter was being used which did not support the "connect_timeout" option to be passed via django. We were able to work around the issue setting the environmental variable "PGCONNECT_TIMEOUT" so libpq would pick up the connection parameter. Put the below in "django.wsgi": os.environ['PGCONNECT_TIMEOUT'] = '30'munin-node and postgresql plugins setupSubmitted by sandip on Sun, 02/05/2012 - 19:37While setting up munin to monitor postgresql, I was getting "[DBD::Pg not found, and cannot do psql yet]" when running `munin-node-configure --suggest | grep postgres`. I confirmed that the rpm package "perl-DBI-1.52-2.el5" was indeed installed. However, when I ran a test against the module, it failed with: # perl -MDBD::Pg -e 1On checking the library, it returned with "libpq.so.4 => not found": # ldd /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi/auto/DBD/Pg/Pg.soIndeed libpq.so.4 was missing since postgresql90-libs was installed which only includes "libpq.so.5". To get libpq.so.4, "compat-postgresql-libs" package needed to be installed. Once installed the perl module test passed and I was able to get the munin plugins linked using: # munin-node-configure --shell | grep postgres | shConfiguring Bind RNDCSubmitted by sandip on Tue, 12/27/2011 - 22:00RNDC is a useful mechanism for administering DNS servers. If it is not configured, BIND complains about it. Determine the locations where RNDC expects to find the config files. # rndc status Create the rndc config file: # rndc-confgen > /etc/rndc.confThy rndc conf file should also have the contents that need to go to "/etc/named.conf". See sample below: # Use with the following in named.conf, adjusting the allow list as needed:Once the key and control section has been added to named.conf, restart named and test again with: # rndc status |
User loginPopular contentToday's:All time:Tag CloudApache
AWK
Bash
BlogMarks
centos
Cheatsheet
chroot
cpu
DirectAdmin
Drupal
ext3
ftp
Hosting
Information Technology
ispconfig
Java
Kernel
lftp
lighttpd
Linux
lvm
mail
mailq
Multimedia
munin
munin-node
MySQL
Networking
nginx
oneliner
openssl
openvz
pam
Perl
PHP
Plesk
PostgreSQL
proftpd
Programming
qmail
redhat
rpm
Scripting
Security
Sendmail
site migration
spf
ssh
ssl
svn
tips
Tips and Tricks
Tipsheet
trac
Tutorials
ubuntu
upgrade
vzdump
Web Development
XML
Who's newWho's onlineThere are currently 0 users and 22 guests online.
LinksFOSS Community: |
Recent comments
3 weeks 1 day ago
3 weeks 2 days ago
4 weeks 5 days ago
6 weeks 1 day ago
7 weeks 6 hours ago
8 weeks 6 days ago
9 weeks 8 hours ago
9 weeks 5 days ago
10 weeks 21 hours ago
12 weeks 23 hours ago