Monthly Archives: March 2012

How to change the directory location of the screenshots in Mac OSX Snow Leopard.

I use Macbook with MacOSX Leopard, after I upgrade to Snow Leopard, short keys to take screenshots doesn’t make any output file. After searching in google, it is advisable to change the directory location for the screenshot. Here’s how I do. Do these commands using an ordinary user (without admin rights).
 

$ defaults write com.apple.screencapture location ~ / Desktop /
$ killall SystemUIServer

Then please try again to capture the screen. To capture the entire screen display use Cmd-Shift-3, if you want to just capture some of the screen you can use Cmd-Shift-4.

budi mac, openbsd für mac screenshot, os x 10 6 screenshot directory, os x change output directory for screen captures, screen capture for mac without admin privileges, screenshot directory macosx, screenshot folder snow leopard, screenshot in macosx, screenshot leopard how to change, screenshot to folder on snow leopard

Tips to delete sessions file of php in CentOS 5.5

Different from Ubuntu, in CentOS 5.5, I do not find a mechanism to delete files from the php session. Because I’m worried the sessions file is not deleted, I import the fileremoval mechanism of Ubuntu.

I copy the following files from Ubuntu.

$cat /usr/lib64/php/maxlifetime

#!/bin/sh -e
max=1440
for ini in /etc/php.ini; do
cur=$(sed -n -e ‘s/^[[:space:]]*session.gc_maxlifetime[[:space:]]*=[[:space:]]*\([0-9]\+\).*$/\1/p’ $ini 2>/dev/null || true);
[ -z “$cur” ] && cur=0
[ “$cur” -gt “$max” ] && max=$cur
done
echo $(($max/60))
exit 0

Then we create cron file to auto delete the sessions files.

$cat /etc/cron.d/php

# /etc/cron.d/php5: crontab fragment for php5
# This purges session files older than X, where X is defined in seconds
# as the largest value of session.gc_maxlifetime from all your php.ini
# files, or 24 minutes if not defined. See /usr/lib/php5/maxlifetime
# Look for and purge old sessions every 30 minutes
09,39 * * * * root [ -x /usr/lib64/php/maxlifetime ] && [ -d /var/lib/php/session ] && find /var/lib/php/session -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib64/php/maxlifetime) -delete

That’s it.

centos php session files, /var/lib/php/session, clear /var/lib/php/session, centos delete file, clear file centos, how to clear php session files linux, what is $cat in centos, centos ramcache sessions, php-session centos 6 6, linux delete php session files