Cron & unlink

Cron & unlink

am 02.07.2006 23:28:14 von Ron Piggott

Does anyone have experience in getting unlink to work within the context
of a cron?

I created my own garbage collection function and I am trying to delete
some session files through a cron that runs every 10 minutes.

The session files are owned by 'www'
The cron is ran by 'actsmin'

The 'unlink' command works within the context of a php script when
activated by a user on the web site.

Is there another file deletion command within PHP other than unlink?

Here is the error message I am e-mailed by the cron when it doesn't
successfully delete a session file:


> Warning: unlink(/path/to/sessions/files/):
> Is a directory in /path/to/php/script/cron/calls/script.php on line 47

Any suggestions?

Ron

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Cron & unlink

am 03.07.2006 01:46:39 von Chris

Ron Piggott (PHP) wrote:
> Does anyone have experience in getting unlink to work within the context
> of a cron?
>
> I created my own garbage collection function and I am trying to delete
> some session files through a cron that runs every 10 minutes.
>
> The session files are owned by 'www'
> The cron is ran by 'actsmin'
>
> The 'unlink' command works within the context of a php script when
> activated by a user on the web site.
>
> Is there another file deletion command within PHP other than unlink?
>
> Here is the error message I am e-mailed by the cron when it doesn't
> successfully delete a session file:
>
>
>> Warning: unlink(/path/to/sessions/files/):
>> Is a directory in /path/to/php/script/cron/calls/script.php on line 47

That has nothing to do with whether this is running from cron or not.

unlink is to remove files, rmdir is used to remove directories.

Since /path/to/sessions/files/ is a directory, you can't use unlink to
remove it.

Please read the documentation, it's quite clear for these functions.

--
Postgresql & php tutorials
http://www.designmagick.com/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Re: Cron & unlink

am 03.07.2006 02:12:54 von Dave W

------=_Part_23040_25928456.1151885574058
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

You have to use the absolute (or server, whatever you want to call it) path.
So like..../home/www/sessions/files/ or whatever it is.

On 7/2/06, Ron Piggott (PHP) wrote:
>
> Does anyone have experience in getting unlink to work within the context
> of a cron?
>
> I created my own garbage collection function and I am trying to delete
> some session files through a cron that runs every 10 minutes.
>
> The session files are owned by 'www'
> The cron is ran by 'actsmin'
>
> The 'unlink' command works within the context of a php script when
> activated by a user on the web site.
>
> Is there another file deletion command within PHP other than unlink?
>
> Here is the error message I am e-mailed by the cron when it doesn't
> successfully delete a session file:
>
>
> > Warning: unlink(/path/to/sessions/files/):
> > Is a directory in /path/to/php/script/cron/calls/script.php on line 47
>
> Any suggestions?
>
> Ron
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>


--
Dave W

------=_Part_23040_25928456.1151885574058--

Re: Cron & unlink

am 03.07.2006 02:14:04 von Dave W

------=_Part_23044_33167698.1151885644534
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

oops. yea, chris is right. I thought you were trying to delete files.

On 7/2/06, Dave W wrote:
>
> You have to use the absolute (or server, whatever you want to call it)
> path. So like..../home/www/sessions/files/ or whatever it is.
>
>
> On 7/2/06, Ron Piggott (PHP) wrote:
> >
> > Does anyone have experience in getting unlink to work within the context
> > of a cron?
> >
> > I created my own garbage collection function and I am trying to delete
> > some session files through a cron that runs every 10 minutes.
> >
> > The session files are owned by 'www'
> > The cron is ran by 'actsmin'
> >
> > The 'unlink' command works within the context of a php script when
> > activated by a user on the web site.
> >
> > Is there another file deletion command within PHP other than unlink?
> >
> > Here is the error message I am e-mailed by the cron when it doesn't
> > successfully delete a session file:
> >
> >
> > > Warning: unlink(/path/to/sessions/files/):
> > > Is a directory in /path/to/php/script/cron/calls/script.php on line 47
> >
> >
> > Any suggestions?
> >
> > Ron
> >
> > --
> > PHP Database Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>
>
> --
> Dave W
>



--
Dave W

------=_Part_23044_33167698.1151885644534--