is there a module out there to schedule / see whats scheduled for crons?
if not i might write something this summer, the two thoughts ive had on it are either
a) have the module ssl into the server you want to monitor cron jobs for and then it can get crons and set them via the admin interface. while that seems like a good idea it might be a potential security risk, maybe? thoughts?
b) when installing the module install a script as a cron which checks (every 5 mins or something) the database zikula uses to see if the user has set a new job/update the jobs on the server and stuff, seems like it is probably safer but less function/harder setup
anyone have thoughts?
Watch
GitHub Core
Show your support for Zikula! Sign up at Github account and watch the Core project!
GitHub Modules
- internetking created topic »password problem« 25. May
- mesteele101 responded to »ERR (3): E_USER_ERROR: Smarty error: [in pagesvar:pagesitem2en line XXX]…« 25. May
- mazdev responded to »Pages 2.5.0 and updating - Page not found« 25. May
- ehdwma created topic »Hide "Register new account" and change template to 3 col« 25. May
- mesteele101 responded to »Zikula 1.3.3 - Selecting a category in Pages not working« 25. May
- mdee created topic »How to implement returnpage ?« 25. May
- nestormateo responded to »Fillters in Clip« 24. May
Zikula Blog
- Anatomy of Open Source Projects on Mar 07
- Continuous Review on Mar 01
- Not Invented Here on Feb 24
- How to Contribute Your Code at Github on Jan 13
- 10 Steps to Coding-Nirvana: Tips for Successful Module Writing on Nov 12
- Submitting Bug Report Tickets That Get Results on Aug 17
- Cozi Tricks #1: Syntax Highlighting on Aug 07
Login
module for cron jobs
-
- Rank: Softmore
- Registered: Sep 30, 2008
- Last visit: May 29, 2010
- Posts: 201
-
- Rank: Developer
- Registered: Feb 17, 2005
- Last visit: May 21, 2010
- Posts: 684
There exist a module called scheduler by Mark West IIRC (http://community.zik…ub-tid-3-pid-68.htm). Not sure if it works on Zikula. Some other modules use an invisible block which display function triggers 'regularly executed' actions. Personally hate the latter solutions, though it might be the only solution if access to cron jobs is not available.
Remember I did sort of scheduler for a client based on a crontab entry that invoked wget and did all kind of security checks. -
- Rank: Developer
- Registered: May 17, 2004
- Last visit: Apr 08, 2010
- Posts: 386
the concept is interesting, in order to do that, perhaps you can create a "batch user" which will have specific permissions.
But, how can we identified this user ,
- ip ... no (the job will be run on the server)
- user without login .. yes
- user which can't use post or get value ...
You've got 2 hours ^^ -
- Rank: Developer
- Registered: Feb 17, 2005
- Last visit: May 21, 2010
- Posts: 684
ip of server will be 127.0.0.1
through wget you can use '--load-cookies=FILE' and thus be a logged in user
I remember one specific issue with the cookie domain: it had to start with a dot '.domain.tld'.
I used something like this in my crontab:
Code
55 22 * * * /usr/bin/wget --user-agent=scheduler@domain.tld http://www.domain.tld/scheduler.php > /dev/null
and then this in scheduler.php:
Code
define('_SCHEDULERADMINEMAIL', 'xyz@domain.tld');
define('_SCHEDULERAGENT', 'scheduler@domain.tld');
define('_SCHEDULERUSER', 'auser');
define('_SCHEDULERPASSWORD', 'apassword');
define('_IMPORTSCHEDULERREPORTPATH', 'modules/amodule/logs/');
scheduler_invoke();
function scheduler_invoke()
{
if (!($_SERVER['SERVER_ADDR'] === $_SERVER['REMOTE_ADDR'] && $_SERVER['HTTP_USER_AGENT'] === _SCHEDULERAGENT)) {
echo ("Illegal invoke of portal scheduler!");
mail(_SCHEDULERADMINEMAIL, "Illegal invoke of portal scheduler!", "Hi Admin,\n\nOn ".date("Y-m-d h:i:s A")." it seems there was an illegal attempt to start the portal scheduler. Please contact Development IT Solutions (bert.roefs@dits-sa.com) in case of any uncertainty.");
return false;
}
// above are only two checks, but others are imaginable as well
// include PostNuke base api
include 'includes/pnAPI.php';
// start PostNuke
pnInit();
// log in as user scheduler
pnUserLogIn(_SCHEDULERUSER, _SCHEDULERPASSWORD);
// do whatever you want to do as a user
I probably stole some of this from the scheduler module I referred to above. -
- Rank: Softmore
- Registered: Sep 30, 2008
- Last visit: May 29, 2010
- Posts: 201
what i think would be neat is to not only be able to add/modify jobs on the server but to be able to schedule module functions as well, so a module (not the cron module) could create a job when it is initiated, and have a function in the modules code and the cron job would just hit that function based on its schedule.
this could be done without cron to get the same results but it would require sufficiently high traffic on the site because the scheduled tasks couldn't be run without users being on the site. if you see my meaning, thats why i would like to see/make a module to allow for actual cron. i could see it being a very useful tool in zikula, not just for the module itself but for other modules which could implement it. -
- Rank: Developer
- Registered: Feb 17, 2005
- Last visit: May 21, 2010
- Posts: 684
Whether you invoke what you call from a UNIX crontab or from a block (or whatever else is dependent on traffic to run) shouldn't matter in terms of what you call (pnModFunc).
I'd recommend not requiring any modifications to existing modules. You could perhaps think of listing (extracting from module files) available user / user API / admin / admin API functions of other modules. Or you could offer a 'new task' interface listing available modules, their function types, and provide 'free text' parameter arrays. Just a few thoughts. -
- Rank: Developer
- Registered: Feb 17, 2005
- Last visit: May 21, 2010
- Posts: 684
Whatever module functions you call, you need to think about what permissions are required. That's why mumuri remarked that 'users without login' should be fine, but users that require certain permissions ... .
Cron type of functions would often admin type of functions. If you invoke a cron module based of access of an anonymous visitor you sort of need to 'fork a separate process with a logged in administrator' to perform admin functions. Getting security and permissions right is a major issue for such a module.
- Moderated by:
- Support
Users on-line
- 0 users
This list is based on users active over the last 60 minutes.
