I'm starting to think we talk two different languages (and there's a little 
bit of lack of shell scripting on your side).
cron syntax is a taddle bit universal.... that being said there is a subtle 
difference between web2py's cron and a "normal" cron (explained in the 
book).
Cron is made specifically to start a program that ends soon at specified 
intervals: it's not meant to start a daemon that stays forever alive.
session2trash.py has "2 modes": one is "prune sessions and exit" and the 
other is "prune sessions and sleep in a loop".
The second behaviour is the default one, and the first is triggered 
whenever -o is included as an argument. 
At the beginning of the script there are examples for both modes.
Now........ either you have access to a shell and you want a resident 
process that prunes sessions every once in a while OR you schedule the same 
script in cron with -o (in your case, to save precious resources).

this line

nohup python web2py.py -S app -M -R scripts/sessions2trash.py &


enables the "second behaviour", that is the one that you SHOULD NOT use in 
a cron line.

What you should instead schedule is 

web2py.py -S app -M -R scripts/sessions2trash.py -A -o

(optionally adding something like "-x 3600 -f -v" to enable other useful 
options) 

PS: you definitely DO NOT want to schedule apache on cron



On Wednesday, July 16, 2014 6:50:53 PM UTC+2, Annet wrote:
>
> Since I have access to my system's own cron service I use *external cron*
>
> The issue seems to be that
>
> */5 * * * * ~/webapps/w2p/web2py/web2py.py -S admin -R 
> scripts/sessions2trash.py &
> */5 * * * * ~/webapps/w2p/web2py/web2py.py -S mypynex -R 
> scripts/sessions2trash.py &
>
> are starting web2py and its cron sub system, which stays resident in 
> memory which is
> why web2py processes start to pile up.
>
>
> I had a similar issue with this line in my crontab:
>
> 19,39,59 * * * * ~/webapps/w2p/apache2/bin/start
>
> using the watchdog script Sean wrote, commenting out the first line and 
> adding the second line:
>
> #19,39,59 * * * * ~/webapps/w2p/apache2/bin/start
> */5 * * * * $HOME/bin/watchdog_w2p.sh >> $HOME/logs/user/w2p_watchdog.log 
> 2>&1
>
>
> Since web2py is already running can't I call the sessions2trash.py script 
> in a similar way
> as I call the watchdog script. Why call web2py.py?
>
>
> Regards,
>
> Annet
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to