{path} is to be interpreted by robinhood, not by bash.

So you should change your action to:

default_action = cmd("/root/list_NA30d.sh {path}");

and your script:

#!/bin/bash

echo "$1" >> /tmp/`date "+%Y%m%d"`_NAo30D.lst


Notice that I also dropped "+%Y%m%d%H%M.%S" that changes every second and soit may create many output file...

I suggest instead you just use date "+%Y%m%d", so they will all be written to the same file for a given run (if there is no day change while it's running...)


Thomas.


On 10/07/16 10:25, [email protected] wrote:

Hi Thomas,

Thanks for your advice.

After modified default_action from cmd("/bin/rbh-find /work1/ -mtime +30 > /tmp/NAo30D.lst") to cmd("echo {path} >> /tmp/NAo30D.lst") and ran robinhood --run="check_idle" --once again, those processes rbh-find terminated.

Do you have any idea about output an files which we applied policy on it?

I have tried to produce list of files but always fail:

-bash-4.2# cat /etc/robinhood.d/includes/check_idle_30d.inc
define_policy check_idle {
    status_manager = basic;
    scope { type == file and status == ""}
    default_action = cmd("/root/list_NA30d.sh");
    default_lru_sort_attr = none;
}

check_idle_trigger {
    trigger_on = periodic;
    check_interval = 30d;
}

-bash-4.2# cat /root/list_NA30d.sh
#!/bin/bash

echo {path} >> /tmp/`date "+%Y%m%d%H%M.%S"`_NAo30D.lst


Here is what we got:

-bash-4.2# tail /tmp/201610071530.36_NAo30D.lst
{path}
{path}
{path}
{path}
{path}
{path}
{path}
{path}
{path}
{path}

Is there any method which we can produce list file?(redirection is not working in robinhood)

Regards
******************************************************
Bruce Chen
System Planning Dept.
System Technology & Management Div.
Acer Cybercenter Service Inc.
******************************************************

------------------------------------------------------------------------
*From:* LEIBOVICI Thomas [[email protected]]
*Sent:* Friday, October 07, 2016 2:16 PM
*To:* Chen, Bruce; [email protected]
*Cc:* MARTINET Dominique 606316
*Subject:* Re: [robinhood-support] It takes long time to run the policy - 2016/10/06

On 10/07/16 03:59, [email protected] wrote:

Hi Thomas,

Thanks for your explanation.

We ran the command several times to test policy:

robinhood --run="check_idle" --once

Original setting is that running policy per hour, we modified it to 30 days then.

However, we found that there are several processes still running on system.

-bash-4.2# ps -ef | grep rbh-find
root 38536 10473 9 09:40 ? 00:00:09 /bin/rbh-find /work1 -mtime +30 > /tmp/NAo30D.lst root 38537 10473 9 09:40 ? 00:00:09 /bin/rbh-find /work1 -mtime +30 > /tmp/NAo30D.lst root 38538 10473 10 09:40 ? 00:00:09 /bin/rbh-find /work1 -mtime +30 > /tmp/NAo30D.lst root 38539 10473 9 09:40 ? 00:00:09 /bin/rbh-find /work1 -mtime +30 > /tmp/NAo30D.lst

Tried to stop then start robinhood daemon, but daemon always startup those processes.

Is there any method that we can stop those processes?

I think there is something to do with the systemd configuration.
@Dominique, can you give him an hint?

BTW, thinking about your policy rules, this should be more efficient and make it possible for robinhood to optimize its DB query:

check_idle_rules {
    ignore { last_mod < 30d }
    rule default {
        condition { last_access > 30d }
    }
}

This way robinhood will only select entry with last_mod > 30d from the DB
and then stat the entry to check its atime, and then do the policy action.

Thomas.

Regards
******************************************************
Bruce Chen
System Planning Dept.
System Technology & Management Div.
Acer Cybercenter Service Inc.
******************************************************

------------------------------------------------------------------------
*From:* Thomas LEIBOVICI (mail perso) [[email protected]]
*Sent:* Friday, October 07, 2016 2:23 AM
*To:* Chen, Bruce; [email protected]
*Subject:* Re: [robinhood-support] It takes long time to run the policy - 2016/10/06

Hi Bruce,

Le 06/10/2016 à 10:13, [email protected] wrote:

Hi,

I define policy as following:

-bash-4.2# cat /etc/robinhood.d/includes/check_idle_30d.inc
define_policy check_idle {
    status_manager = basic;
    scope { type == file and status == ""}


    # only for policy matching, not to display in reports

(cosmetic. you can remove this comment. It should be about a line you deleted).


default_action = cmd("/bin/rbh-find /work1/ -mtime +30 > /tmp/NAo30D.lst");

You have to know that this action is run for every entry that matches your policy rule!
So in this case, you run the same find command for many entries!

If I correctly understand what you want to do, your policy rule condition should be:
     {last_access > 30d and last_mod> 30d}
and the action should be something like:
    echo {fullpath} >> /tmp/your_list

(not sure how robinhood commands manages redirections like > or >> in commands,
but you can still write a script process_entry.sh that does this).

Hope this helps,
Thomas

default_lru_sort_attr = none;
}

check_idle_trigger {
    trigger_on = scheduled;
    check_interval = 1h;
}

rule in /etc/robinhood.d/<filesystem>.conf

check_idle_rules {
    rule default {
        condition { last_access > 30d }
    }
}

What the policy is testing to produce an list which files have not been access over 30 days.

We found that it took long time that just run job directory with command line "/bin/rbh-find /work1/ -mtime +30 > /tmp/NAo30D.lst".

Could you please give a clue about the issue?

Regards
******************************************************
Bruce Chen
System Planning Dept.
System Technology & Management Div.
Acer Cybercenter Service Inc.
******************************************************

==---------------------------------------------------------------
This email contains information that is for sole use of the intended recipient and may be confidential or privileged.If you are not the intended recipient, any further review, disclosure, copying, distribution, or use of this email, or the contents of this email is prohibited. Please notify the sender by reply this email and destroy the original email if your receipt of this email is in error.
---------------------------------------------------------------==


==---------------------------------------------------------------
This email contains information that is for sole use of the intended recipient and may be confidential or privileged.If you are not the intended recipient, any further review, disclosure, copying, distribution, or use of this email, or the contents of this email is prohibited. Please notify the sender by reply this email and destroy the original email if your receipt of this email is in error.
---------------------------------------------------------------==



------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most 
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
robinhood-support mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/robinhood-support

Reply via email to