Run js script with cron from scheduled-jobs-context.xml
![svetlingulev svetlingulev](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2014 12:13 PM
hi,
i have a .js script that a want to run every 1 hour.
I am following this tutorial http://aboutalfresco.blogspot.com/2010/01/scheduled-actions-in-alfresco.html
I've read about Scheduled Actions and i have some questions:
1. The file scheduled-jobs-context.xml must be put in tomcat/shared/alfresco/classes/extension directory right? And from there it will do its job?
2. The js script that i want the cron to run is called "hello.get.js" and it is located in Company Home > Data Dictionary > Web Scripts > org > alfresco > test
and according to the tutorial that i`m following this should be ${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home/app:dictionary/app:scripts/cm:hello.get.js"' )} , right ?
best regards
i have a .js script that a want to run every 1 hour.
I am following this tutorial http://aboutalfresco.blogspot.com/2010/01/scheduled-actions-in-alfresco.html
I've read about Scheduled Actions and i have some questions:
1. The file scheduled-jobs-context.xml must be put in tomcat/shared/alfresco/classes/extension directory right? And from there it will do its job?
2. The js script that i want the cron to run is called "hello.get.js" and it is located in Company Home > Data Dictionary > Web Scripts > org > alfresco > test
and according to the tutorial that i`m following this should be ${selectSingleNode('workspace://SpacesStore', 'lucene', 'PATH:"/app:company_home/app:dictionary/app:scripts/cm:hello.get.js"' )} , right ?
best regards
Labels:
- Labels:
-
Archive
4 REPLIES 4
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2014 01:33 PM
Check out the file - <strong>"scheduled-action-services-context.xml.sample"</strong> under <strong>tomcat\shared\classes\alfresco\extension</strong>. Rename it to scheduled-action-services-context.xml and check out for various sample jobs in it. After adding/modifying you bean definition restart the server to make the changes reflect.
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-02-2014 01:25 PM
1. Yes ,scheduled-jobs-context.xml must be put in tomcat/shared/alfresco/classes/extension folder.it will trigger the quartz job you configured in CronScheduledQueryBasedTemplateActionDefinition class.
2.If the scrip you want to run located in
By the way why not put your js into
2.If the scrip you want to run located in
Company Home > Data Dictionary > Web Scripts > org > alfresco > test
you should write it like<!–note that after alfresco 4.0, freemarker entries must be escaped–><value>\$\{selectSingleNode('workspace://SpacesStore', 'lucene','PATH:"/app:company_home/app:dictionary/cm:webscripts/cm:org/cm:alfresco/cm:test/cm:hello.get.js"')\}</value>
By the way why not put your js into
Company Home > Data Dictionary > scripts
![svetlingulev svetlingulev](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-03-2014 06:35 AM
kaynezhang, thanks
i have put my js file in Company Home > Data Dictionary > scripts
but an error is rised
i have put my js file in Company Home > Data Dictionary > scripts
but an error is rised
and here is my javacript code in file createsite.jsvar sitePreset = "site-dashboard"; var shortName = "helloworld"; var title = "Hello World"; var description = "The Hello World site!"; var visibility = siteService.PUBLIC_SITE;var myNewSite = siteService.createSite(sitePreset, shortName, title, description, visibility);
![svetlingulev svetlingulev](https://connect.hyland.com/legacyfs/online/avatars/Blue-user-logo.png)
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-04-2014 09:09 AM
the problem is resolved. I used the Script Action Example at the end of this page https://wiki.alfresco.com/wiki/Scheduled_Actions
and just changed the place and the name of the script.
and just changed the place and the name of the script.
![](/skins/images/A90266AC6EB1934BC937DAFB2842964E/responsive_peak/images/icon_anonymous_message.png)