Hi, Someone knows how to run periodically a JS script ?? The purpose is to write to a db some global informations (Global Variables) about FS like every 5 minutes. Thanks. -- View this message in context: http://old.nabble.com/How-to-run-a-JS-script-periodically-tp26625147p2662514... Sent from the Freeswitch-users mailing list archive at Nabble.com.
Not sure about js, but in lua, you can use luarun to run a long-running script like loop do sth. sleep 5min end and also it can be set to start with freeswitch in lua.conf.xml I guess you can also use jsrun to run js. And, if you run every 5 min, why not use crontab? fs_cli -x "jsrun xx.js" 2009/12/3 Oscav <oscav@hotmail.fr>:
Hi,
Someone knows how to run periodically a JS script ?? The purpose is to write to a db some global informations (Global Variables) about FS like every 5 minutes.
Thanks.
-- View this message in context: http://old.nabble.com/How-to-run-a-JS-script-periodically-tp26625147p2662514... Sent from the Freeswitch-users mailing list archive at Nabble.com.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
If doing this, I'd suggest checking for a global var to see if the script should terminate itself. Otherwise, you'll have to bring down the whole freeswitch to stop this script. On Thu, Dec 3, 2009 at 7:28 AM, Seven Du <dujinfang@gmail.com> wrote:
Not sure about js, but in lua, you can use luarun to run a long-running script like
loop do sth. sleep 5min end
and also it can be set to start with freeswitch in lua.conf.xml
I guess you can also use jsrun to run js.
And, if you run every 5 min, why not use crontab?
fs_cli -x "jsrun xx.js"
2009/12/3 Oscav <oscav@hotmail.fr>:
Hi,
Someone knows how to run periodically a JS script ?? The purpose is to
write
to a db some global informations (Global Variables) about FS like every 5 minutes.
Thanks.
-- View this message in context: http://old.nabble.com/How-to-run-a-JS-script-periodically-tp26625147p2662514... Sent from the Freeswitch-users mailing list archive at Nabble.com.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- -Rupa
What about cron? Create a cron entry like: */5 * * * * /usr/local/freeswitch/bin/fs_cli -x "jsrun yourscript &app()" But if you're just dumping global variables, you could easily retrieve them directly from fs_cli without running an app and process the output however you'd like: /usr/local/freeswitch/bin/fs_cli -x "global_getvar" On Thu, Dec 3, 2009 at 6:21 AM, Oscav <oscav@hotmail.fr> wrote:
Hi,
Someone knows how to run periodically a JS script ?? The purpose is to write to a db some global informations (Global Variables) about FS like every 5 minutes.
Thanks.
-- View this message in context: http://old.nabble.com/How-to-run-a-JS-script-periodically-tp26625147p2662514... Sent from the Freeswitch-users mailing list archive at Nabble.com.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
You could also use the scheduler to run the jsrun command inside FreeSWITCH. Mike On Dec 3, 2009, at 8:31 AM, Rob Forman wrote:
What about cron?
Create a cron entry like: */5 * * * * /usr/local/freeswitch/bin/fs_cli -x "jsrun yourscript &app()"
But if you're just dumping global variables, you could easily retrieve them directly from fs_cli without running an app and process the output however you'd like:
/usr/local/freeswitch/bin/fs_cli -x "global_getvar"
On Thu, Dec 3, 2009 at 6:21 AM, Oscav <oscav@hotmail.fr> wrote:
Hi,
Someone knows how to run periodically a JS script ?? The purpose is to write to a db some global informations (Global Variables) about FS like every 5 minutes.
fs_cli looks like a good idea. I will try that. Many thanks Rob Rob Forman wrote:
What about cron?
Create a cron entry like: */5 * * * * /usr/local/freeswitch/bin/fs_cli -x "jsrun yourscript &app()"
But if you're just dumping global variables, you could easily retrieve them directly from fs_cli without running an app and process the output however you'd like:
/usr/local/freeswitch/bin/fs_cli -x "global_getvar"
On Thu, Dec 3, 2009 at 6:21 AM, Oscav <oscav@hotmail.fr> wrote:
Hi,
Someone knows how to run periodically a JS script ?? The purpose is to write to a db some global informations (Global Variables) about FS like every 5 minutes.
Thanks.
-- View this message in context: http://old.nabble.com/How-to-run-a-JS-script-periodically-tp26625147p2662514... Sent from the Freeswitch-users mailing list archive at Nabble.com.
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
_______________________________________________ FreeSWITCH-users mailing list FreeSWITCH-users@lists.freeswitch.org http://lists.freeswitch.org/mailman/listinfo/freeswitch-users UNSUBSCRIBE:http://lists.freeswitch.org/mailman/options/freeswitch-users http://www.freeswitch.org
-- View this message in context: http://old.nabble.com/How-to-run-a-JS-script-periodically-tp26625147p2663516... Sent from the Freeswitch-users mailing list archive at Nabble.com.
participants (5)
-
Michael Jerris
-
Oscav
-
Rob Forman
-
Rupa Schomaker
-
Seven Du