11/25/2015

[Linux] find old files and delete, or move



Example: delete files older than one year
find /path/to/source  -mtime +365 -exec rm {} \;

Example: move files older than one year.
find /path/to/source -mtime +365 -exec mv {} /path/to/destination/ \;

Example: find files which file name starts ABC and older than 30 days and move.

find . -name "ABC*.csv" -mtime +30 -exec mv {} /path/to/destination/  \;

8/24/2015

エラーメールの判別方法


エラーメールの判別方法

in reply to end of DATA command
<xxx_example@docomo.ne.jp>: host mfsmax.docomo.ne.jp[203.138.181.240]
    said: 550 Unknown user xxx_example@docomo.ne.jp (in reply to end of DATA command)

指定ドメイン拒否(デフォルト設定)

docomo端末の設定で、ドメイン許可リストに該当ドメインを指定する。
================
<xxx_doesnt_exist@gmail.com>: host aspmx.l.google.com[74.125.203.27] said: 550-5.1.1
    The email account that you tried to reach does not exist. Please try
    550-5.1.1 double-checking the recipient's email address for typos or
    550-5.1.1 unnecessary spaces. Learn more at 550 5.1.1
    https://support.google.com/mail/answer/6596 tn4si27093780pbc.45 - gsmtp (in reply to RCPT TO command)

宛先不明 -> メールアドレスに間違いがないか確認する。

================

5/29/2015

Change timezone from UTC with RDS instance


Here is how to change timezone setting in your RDS instance

1, connect your RDS instance as root.
[user@ec2 ~]$ mysql -u root -p -h xxxxxx.yyyyyy.zzzzzz.rds.amazonaws.com

2. Change the timezone setting.
mysql> DELIMITER |
mysql> CREATE PROCEDURE mysql.`set_PST`()
    -> IF NOT (POSITION('rdsadmin@' IN CURRENT_USER()) = 1) THEN
    ->    SET SESSION time_zone = 'America/Los_Angeles';
    -> END IF |
mysql> DELIMITER ;

3. Create parameter group
find init_connect parameter and input 'CALL set_PST'. Then save changes.

4. Apply new parameter group to your RDS instance.

5. Log in to your RDS instance. Then submit the following command.

mysql> GRANT EXECUTE ON PROCEDURE mysql.set_PST TO 'username'@'hostname';


5/22/2015

サイボウズガルーン v4.0.1、パッケージ版URLからクラウド版URLのリダイレクト

I figured out how to redirect web pages on Cybozu Garoon package edition to their cloud edition.
work as root user.

cd /var/www/cgi-bin/cbgrn/
mv grn.cgi grn.cgi.org
vi grn.cgi
write redirect script like following. then save it.
#!/usr/bin/perl

$uri = $ENV{'REQUEST_URI'};
my @param = split('grn.cgi',$uri);
$rdrURL =  "Location: https://xxxxxx.cybozu.com/g/$param[1]\n\n";
print $rdrURL;

exit;

chmod 755 grn.cgi
chown apache:root grn.cgi

That's it! Test the redirection.