martedì 7 settembre 2010

Come cambiare i permessi di directory o files ricorsivamente

Recursively chmod directories only

June 19th, 2006

find . -type d -exec chmod 755 {} \;

This will recursively search your directory tree (starting at dir 'dot') and chmod 755 all directories only.

Similarly, the following will chmod all files only (and ignore the directories):

find . -type f -exec chmod 644 {} \;



Cerchi qualcosa ? (un file che contiene una certa stringa ?)

Grep all files in a directory for a string

grep -i -r somestring ./

-i means ignore case
-r means recursive

Simple stuff, but useful nonetheless.


from
http://movabletripe.com/

venerdì 3 settembre 2010

JQuery UI Vs Tool (alias una poltrona per due)

Far convivere JQuery UI e JQuery Tool


Queste due ottime librerie apparentemente non possono essere usate contemporaneamente... in realtà il problema a quanto pare sta solo nel tabs. Quindi una soluzione che per ora sembra funzionare è quella di non includere i tab in una delle due librerie.

mercoledì 1 settembre 2010

Mdadm spedisce una mail quando un md device fallisce

Getting E-mail notifications when MD devices fail

I use the MD (multiple device) logical volume manager to mirror the boot devices on the Linux servers I support. When I first started using MD, the mdadm utility was not available to manage and monitor MD devices. Since disk failures are relatively common in large shops, I used the shell script from my SysAdmin article Monitoring and Managing Linux Software RAID to send E-mail when a device entered the failed state. While reading through the mdadm(8) manual page, I came across the "–monitor" and "–mail" options. These options can be used to monitor the operational state of the MD devices in a server, and generate E-mail notifications if a problem is detected. E-mail notification support can be enabled by running mdadm with the "–monitor" option to monitor devices, the "–daemonise" option to create a daemon process, and the "–mail" option to generate E-mail:

$ /sbin/mdadm --monitor --scan --daemonise --mail=root@localhost

Once mdadm is daemonized, an E-mail similar to the following will be sent each time a failure is detected:

From: mdadm monitoring 
To: root@localhost.localdomain
Subject: Fail event on /dev/md1:biscuit

This is an automatically generated mail message from mdadm
running on biscuit

A Fail event had been detected on md device /dev/md1.

Faithfully yours, etc.

preso da http://prefetch.net/blog/index.php/2006/08/20/getting-e-mail-notifications-when-md-devices-fail/

smartmontools debian lenny

Hard disk health monitoring in Debian Lenny using smartmontools

impostazioni per il settaggio di S.M.A.R.T. su debian lenny --> very cool


Install smartmontools from the repository.

thinkpad:~# aptitude install smartmontools

Enable SMART monitoring on the SATA drive.

thinkpad:~# smartctl -s on  -d ata /dev/sda

Check the health of the drive.

thinkpad:~# smartctl -d ata -H /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

Run a short self test on the drive and check the test log.

thinkpad:~# smartctl -t short /dev/sda
thinkpad:~# smartctl -l selftest /dev/sda
smartctl version 5.38 [i686-pc-linux-gnu] Copyright (C) 2002-8 Bruce Allen
Home page is http://smartmontools.sourceforge.net/

=== START OF READ SMART DATA SECTION ===
SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%      4156         -

In order to configure smartd to monitor the hard disk, enable it in /etc/default/smartmontools.

# uncomment to start smartd on system startup
start_smartd=yes

Set the schedule and monitoring options by editing /etc/smartd.conf.


Comment out all the DEVICESCAN lines and add a line for the main hard drive.

# First (primary) ATA/IDE hard disk.  Monitor all attributes, enable
# automatic online data collection, automatic Attribute autosave, and
# start a short self-test every day between 2-3am, and a long self test
# Saturdays between 3-4am. Send mail on SMART failures
/dev/sda -a -o on -S on -s (S/../.././02|L/../../6/03) -m naveen@localhost

Start the smart daemon.

thinkpad:~# /etc/init.d/smartmontools restart
* Restarting S.M.A.R.T. daemon smartd            [ OK ]