2012 January

genkernel

genkernel --no-clean --install --symlink --disklabel --menuconfig all

disable device drv – networking -atm

By WladyX on 27 January, 2012 | Gentoo | A comment?

Grow /tmp on AIX

Check for space: lsvg rootvg
Grow with 100MB: chfs -a size=+100M /tmp

By WladyX on 26 January, 2012 | AIX | A comment?

Find and remove files older than 30 days

find /folder -type f -mtime +30 -exec rm -rf {} \;

By WladyX on | Scripts | A comment?

Subfolder Limitation

Some time a go i see the same limitations in AIX JFS and JFS2 . As i
know this is functional limitation and you can’t have more that 32765
subdirectories on one level :-(
This is hardcoded limitation of JFS/JFS2 and can’t be avoided
source
By WladyX on | AIX | A comment?

Bash eternal history

export HISTTIMEFORMAT="%h/%d - %H:%M:%S "
PROMPT_COMMAND="${PROMPT_COMMAND:+$PROMPT_COMMAND ; }"'echo $$ $USER \
"$(history 1)" >> ~/.bash_eternal_history'

source

By WladyX on 24 January, 2012 | General, Scripts | 1 comment

Reducing ibdata1 in mysql

/etc/mysql/my.cnf:
innodb_file_per_table

Dump all databases by calling:

/usr/bin/mysqldump --extended-insert --all-databases --add-drop-database --disable-keys --flush-privileges --quick --routines --triggers > all-databases.sql

Stop the MySQL server;
Rename or remove (in case you’ve already backed it up) the MySQL data directory and create an empty one with the same name and permissions;
Make the appropriate changes in my.cnf;
Re-initialize the database with the following command (replace the ‘mysqld‘ with the login of the user your MySQL server runs as) (10x, Påven):

sudo -u mysqld mysql_install_db

Start the MySQL server;
Get into the ‘mysql‘ console and type:

SET FOREIGN_KEY_CHECKS=0;
SOURCE all-databases.sql;
SET FOREIGN_KEY_CHECKS=1;

Restart the MySQL server. (10x, czaby)

At this point everything should be fine and you can test it by starting again the services that use MySQL.

source

By WladyX on 23 January, 2012 | Mysql | A comment?

SQUID log analizer

By WladyX on 20 January, 2012 | Cool Apps, Squid | A comment?

Linux audit files to see who made changes to a file

By WladyX on | Cool Apps | A comment?

TT-RSS Update daemon keeps killing other processes

http://tt-rss.org/redmine/issues/417

Workaround:

don’t run the update daemon as root!

By WladyX on 16 January, 2012 | Apache | A comment?

Mail to SMS using procmail

Installation
Once you have plugged the USB Data cable and the T230 phone, you may have:

root@smsserver:~# lsusb
Bus 001 Device 002: ID 067b:2303 Prolific Technology, Inc. PL2303 Serial Port
Bus 001 Device 001: ID 0000:0000
root@fr-c400-0257-l:~# ls -la /dev/ttyUSB0
crw-rw---- 1 root dialout 188, 0 2007-03-22 10:17 /dev/ttyUSB0
root@smsserver:~#

You can test your configuration using minicom

root@smsserver:~# minicom -s

-s is for minicom setup on launch. You may configure the serial port to /dev/ttyUSB0 and the speed to 9600 8N1.

Welcome to minicom 2.2
OPTIONS: I18n
Compiled on Mar 7 2007, 15:10:03.
Port /dev/ttyUSB0

Press CTRL-A Z for help on special keys

AT S7=45 S0=0 L1 V1 X4 &c1 E1 Q0
OK
AT&C1
OK
ATM0
OK
ATDT1234
NO CARRIER
ATM0
OK
AT+CPIN?
+CPIN: READY

OK
AT+CMGF=1
OK
AT+CMGS
ERROR
AT+CMGS="06XXXXXXXX"
> Hello World
+CMGS: 0

OK

gnokii settings
Edit the /etc/gnokiirc file:

port = /dev/ttyUSB0
[...]
model = AT
# model = 6510
[...]
use_locking = no
#use_locking = yes
[...]
serial_baudrate = 9600
# serial_baudrate = 19200

The use_locking setting has been modified as it may happen that I send SMS to more than one people at a time. The solution would be to use smsd…

From Mail to SMS

As we are using postfix and procmail, root user may not be used!
Let’s create a itroot user that will be the recipient of email notification to be turned into SMS.
Create a .procmailrc file for this user. A convention will be used for notification emails. The subject will contain [SMS] and only the subject of the email will be transfered as an SMS:

DEFAULT=/var/spool/mail/itroot
MAILDIR=$HOME/Mail

:0
* ^Subject:.*\[SMS\].*
| cat - | awk -F":” ‘$1 == “Subject” { for(i=2; i <=$NF; i++) $(i-1) = $i; print $0 }’ | sudo /usr/bin/gnokii –sendsms 06XXXXXXXX >> /var/log/SMS.log 2>&1

As you can see, due to permissions issue, itroot as been allowed to invoke gnokii using sudo without password. This implies the following line in /etc/sudoers:

itroot ALL = NOPASSWD: /usr/bin/gnokii

More over, a log file has been created with write permission for itroot user: /var/log/SMS.log". This log file will allow you to make sure that gnokii is doing its job ;-)

source

By WladyX on 12 January, 2012 | Cool Apps, Scripts | A comment?