Re: how to delete folders from a perl agent

Jordi Moles Blanco <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
hi,

thanks.

i will try what you suggest and report back.

thank you very much.



En/na Nicholas Jones ha escrit:
> Use capital R with rm that will remove folders that contain files. So 
> you would need something like:
> `/bin/rm -Rf /home/<user to go bye bye>`
>
> gl,
> Nicholas Jones
>
> On Thu, Aug 28, 2008 at 4:20 AM, Jordi Moles Blanco <[email protected] 
> <mailto:[email protected]>> wrote:
>
>     hi,
>
>     I'm extending snmp functionality through perl.
>
>     I've got this in the snmpd.conf
>
>     **********
>
>     pass    .1.3.6.1.4.1.2021.255   /home/autom/agent.pl
>
>     **********
>
>     then I've got this in the agent.pl
>
>     *********
>     ........
>
>     $ruta = "/usr/home/".$parts[1];
>     `/bin/rm -rf $ruta`;
>     system("/bin/rm -rf $ruta");
>     $quants = rmtree($ruta,1);
>
>     ........
>     *********
>
>     which i call through snmpset like this:
>
>     *************
>
>     snmpset -v 2c -c mypass 192.168.x.xx .1.3.6.1.4.1.2021.255.8.1.2 s
>     "deletehome...test"
>
>     *************
>
>     Well... the thing is that i can't get the script to delete anything in
>     /usr/home. I've tried to setuid the agent.pl file, give it 777.
>     I've even tried to chown /usr/home/whatever snmp, which will never be
>     the case. But still, i can't delete folders. If the folder is empty, i
>     can, otherwise, i can't delete recursively.
>
>     Has anyone come up with a solution for this?
>
>     I'm using debian lenny and snmp 5.4.1
>
>     Thanks.
>
>     -------------------------------------------------------------------------
>     This SF.Net email is sponsored by the Moblin Your Move Developer's
>     challenge
>     Build the coolest Linux based applications with Moblin SDK & win
>     great prizes
>     Grand prize is a trip for two to an Open Source event anywhere in
>     the world
>     http://moblin-contest.org/redirect.php?banner_id=100&url=/
>     <http://moblin-contest.org/redirect.php?banner_id=100&url=/>
>     _______________________________________________
>     Net-snmp-users mailing list
>     [email protected]
>     <mailto:[email protected]>
>     Please see the following page to unsubscribe or change other options:
>     https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
> Build the coolest Linux based applications with Moblin SDK & win great prizes
> Grand prize is a trip for two to an Open Source event anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> ------------------------------------------------------------------------
>
> _______________________________________________
> Net-snmp-users mailing list
> [email protected]
> Please see the following page to unsubscribe or change other options:
> https://lists.sourceforge.net/lists/listinfo/net-snmp-users
>   


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.