|
From: Trastabuga on 18 Jun 2008 12:53 I have a Lisp daemon running on my Linux system (hunchentoot + utilities). I need to process some recurring tasks (some have to be performed daily some monthly). I am wondering what is the best approach to take in this case? I saw timer project for SBCL and it looks promising but I may restart the daemon so it'll loose track of the exact time when to perform the task. I was thinking of Linux cron, but I am not sure how it can send a message to linux process at a certain time and if it's a viable approach for my case... So, any input is welcome! Thank you, Andrew
From: Lars Rune Nøstdal on 18 Jun 2008 13:00 Trastabuga wrote: > I have a Lisp daemon running on my Linux system (hunchentoot + > utilities). > I need to process some recurring tasks (some have to be performed > daily some monthly). > I am wondering what is the best approach to take in this case? > I saw timer project for SBCL and it looks promising but I may restart > the daemon so it'll loose track of the exact time when to perform the > task. I was thinking of Linux cron, but I am not sure how it can send > a message to linux process at a certain time and if it's a viable > approach for my case... So, any input is welcome! > > Thank you, > Andrew http://www.sbcl.org/manual/Timers.html ...sb-ext:schedule-timer takes an :absolute-p argument. Maybe you can use that? I suppose that that absolute point in time might pass while the program isn't running. You could save the next point in time to a file, then check that file on startup; * "has this point in time already passed?" ...and if needed.. * "should something have been done more than once since that point in time?" (has more than one day passed when goal is to do something each day) -- Lars Rune Nøstdal http://nostdal.org/
From: Rupert Swarbrick on 18 Jun 2008 13:31 Lars Rune Nøstdal <larsnostdal(a)gmail.com> writes: > Trastabuga wrote: >> I have a Lisp daemon running on my Linux system (hunchentoot + >> utilities). >> I need to process some recurring tasks (some have to be performed >> daily some monthly). >> I am wondering what is the best approach to take in this case? >> I saw timer project for SBCL and it looks promising but I may restart >> the daemon so it'll loose track of the exact time when to perform the >> task. I was thinking of Linux cron, but I am not sure how it can send >> a message to linux process at a certain time and if it's a viable >> approach for my case... So, any input is welcome! >> >> Thank you, >> Andrew > > http://www.sbcl.org/manual/Timers.html > > ..sb-ext:schedule-timer takes an :absolute-p argument. Maybe you can use that? > > I suppose that that absolute point in time might pass while the > program isn't running. You could save the next point in time to a > file, then check that file on startup; > > * "has this point in time already passed?" > > ..and if needed.. > > * "should something have been done more than once since that point in time?" (has more than one day passed when goal is to do something each day) > > -- > Lars Rune Nøstdal > http://nostdal.org/ Hmm, I don't know anything great offhand, but it seems this is the problem that anacron [1] tries to solve. Maybe there will be some nice ideas in the code for that? Rupert [1] http://anacron.sourceforge.net/
From: Trastabuga on 18 Jun 2008 13:37 On Jun 18, 1:31 pm, Rupert Swarbrick <rswarbr...(a)gmail.com> wrote: > Lars Rune Nøstdal <larsnost...(a)gmail.com> writes: > > > > > Trastabuga wrote: > >> I have a Lisp daemon running on my Linux system (hunchentoot + > >> utilities). > >> I need to process some recurring tasks (some have to be performed > >> daily some monthly). > >> I am wondering what is the best approach to take in this case? > >> I saw timer project for SBCL and it looks promising but I may restart > >> the daemon so it'll loose track of the exact time when to perform the > >> task. I was thinking of Linux cron, but I am not sure how it can send > >> a message to linux process at a certain time and if it's a viable > >> approach for my case... So, any input is welcome! > > >> Thank you, > >> Andrew > > >http://www.sbcl.org/manual/Timers.html > > > ..sb-ext:schedule-timer takes an :absolute-p argument. Maybe you can use that? > > > I suppose that that absolute point in time might pass while the > > program isn't running. You could save the next point in time to a > > file, then check that file on startup; > > > * "has this point in time already passed?" > > > ..and if needed.. > > > * "should something have been done more than once since that point in time?" (has more than one day passed when goal is to do something each day) > > > -- > > Lars Rune Nøstdal > >http://nostdal.org/ > > Hmm, I don't know anything great offhand, but it seems this is the > problem that anacron [1] tries to solve. Maybe there will be some nice > ideas in the code for that? > > Rupert > > [1]http://anacron.sourceforge.net/ > > application_pgp-signature_part > 1KDownload I was trying to find a sample code for SBCL which handle a signal, but I couldn't... I like the idea of some lisp-independent process like cron (or anacron) to run independently of lisp and just send signals to the lisp process. Is there a sample code on how to handle signals in CL (or SBCL in particular?)? Thank you, Andrew
From: Zach Beane on 18 Jun 2008 14:07 Trastabuga <lispercat(a)gmail.com> writes: > I was trying to find a sample code for SBCL which handle a signal, but > I couldn't... > I like the idea of some lisp-independent process like cron (or > anacron) to run independently of lisp and just send signals to the > lisp process. Is there a sample code on how to handle signals in CL > (or SBCL in particular?)? See SB-SYS:ENABLE-INTERRUPT. I have a program that handles SIGWINCH with something like this: (sb-sys:enable-interrupt sb-posix:sigwinch #'update-window-size) Zach
|
Next
|
Last
Pages: 1 2 Prev: Series solution? Next: How to avoid GC in tight numeric test loop? (CMUCL) |