Kroko Just another WordPress weblog

November 10, 2014

Find files modified in the last week.

Filed under: Linux — admin @ 4:13 pm

Change ./ to the root directory you wish to search in. Change -7 to +7 for files changed more than a week ago.

  1. find ./ -mtime -7 -print

-mtime n[smhdw]

             If no units are specified, this primary evaluates to true if the difference between the file last modification time and the time find was started, rounded up to the next full 24-hour period, is n 24-hour periods.

             If units are specified, this primary evaluates to true if the difference between the file last modification time and the time find was started is exactly n units.

             Please refer to the -atime primary description for information on supported time units.

   -atime n[smhdw]

             If no units are specified, this primary evaluates to true if the difference between the file last access time and the time find was started, rounded up to the nextfull 24-hour period, is n 24-hour periods.

             If units are specified, this primary evaluates to true if the difference between the file last access time and the time find was started is exactly n units.  Possible time units are as follows:

             s       second

             m       minute (60 seconds)

             h       hour (60 minutes)

             d       day (24 hours)

             w       week (7 days)

             Any number of units may be combined in one -atime argument, for example, “-atime -1h30m”.  Units are probably only useful when used in conjunction with the + or   modifier.

June 19, 2014

VMWare vSphere ESXi v5.5 Datastore problems

Filed under: Linux — admin @ 2:41 pm

I found an error with vmware esxi. Message from windows client is: Call “HostStorageSystem.ComputeDiskPartitionInfo” for object “storageSystem” on ESXi “x.x.x.x” failed.

I have the issue because the disk that I was using had existing partitions (a Linux swap partition and a Linux MD5 RAID partition).  I had to manually delete the partitions logged in as root to my ESXi box, even though ESXi said it would do that for me.

Useful commands:

# esxcfg-scsidevs -l

this lists the disk devices, the device file will be /dev/disks/<NAME>

output looks like:

t10.ATA_____ST3320620AS_________________________________________6QF1PZXB
   Device Type: Direct-Access
   Size: 305245 MB
   Display Name: Local ATA Disk (t10.ATA_ST3320620AS_6QF1PZXB)
   Multipath Plugin: NMP
   Console Device: /vmfs/devices/disks/t10.ATA_____ST3320620AS_________________________________________6QF1PZXB
   Devfs Path: /vmfs/devices/disks/t10.ATA_____ST3320620AS_________________________________________6QF1PZXB
   Vendor: ATA       Model: ST3320620AS       Revis: 3.AA
   SCSI Level: 5  Is Pseudo: false Status: on
   Is RDM Capable: false Is Removable: false
   Is Local: true  Is SSD: false
   Other Names:
      vml.010000000020202020202020202020202036514631505a5842535433333230
   VAAI Status: unknown

 

Easy solution:

Now can recreate partition table for that disk with a blank one:

for MSDOS run:

 ~ # partedUtil setptbl /dev/disks/naa.600508b1001c95a3d3a1f9455babd2d0 msdos

msdos

0 0 0 0

for HDD larger than 2TB use GPT:

~ # partedUtil setptbl /dev/disks/naa.600508b1001cfb4c4b4ed4e1eee52e25 gpt

gpt

0 0 0 0

Now you have a fresh drive. Try to add again in datastore.

 

Alternative solution:

# partedUtil get /dev/disks/t10.ATA_...

this shows the partitions on the device

output looks like:

38913 255 63 625142448

1 63 514079 130 128

2 514080 625137344 253 0

this disk has 2 partitions, numbers 1 and 2

# partedUtil delete /dev/disks/t10.ATA_... 2

deletes partition 2

# partedUtil delete /dev/disks/t10.ATA_... 1

deletes partition 1

April 21, 2014

Cpanel Disable mod_security2 for a single domain

Filed under: Cpanel — admin @ 10:10 pm

Mod_security is an open source Apache module.

This can be considered as firewall for web applications. It secures the system from the attackers.

The following steps can be used to disable mod_security2 rule for one domain in cPanel servers.

1. Make the directory “/usr/local/apache/conf/userdata/std/2/username/domain.com

2. Create a file “vhost.conf” in the above location

3. Add the following lines :

———-

<IfModule mod_security2.c>

SecRuleEngine Off

</IfModule>

———-

To disable mod_security2 for a particular location :

———

<LocationMatch specify_the_path_here>

<IfModule mod_security2.c>

SecRuleEngine Off

</IfModule>

</LocationMatch>

———

To disable a particular mod_security2 rule :

———

<IfModule mod_security2.c>

SecRuleRemoveById give_ruleID_here

</IfModule>

———

Run the following script after making the changes.

———

/scripts/ensure_vhost_includes --user=username

———

This script will uncomment the following line in apache configuration and restart apache.

———–

Include “/usr/local/apache/conf/userdata/std/2/username/domain.com/*.conf”

« Newer PostsOlder Posts »

Powered by WordPress