View Full Version : help me write cron pls :D
Easy5s.net
06-25-2015, 12:48 AM
Hello all.
Who can help me write cron perform the following actions:
I want users they can establish the time to open, locked their posts over time.
For example, he will setting open topic on Thursday 7:30 - 17:30 on Monday every week, then the thread will be open, locked again by cron.
This is my table open_close:
https://vborg.vbsupport.ru/external/2015/06/4.png
P/S:
- week : 2 = Monday; 4 = Tuesday; 8 = Wednesday; 16 = Thursday; 32 = Friday; 64 = Saturday; 128 = Sunday
Hmm...well, I guess I'd do a query to get all the records from the open_close table ordered by threadid, and probably join it with the thread table to get the open field. Then for each threadid, find the record with the day of week and time that is closest to the current time, but before the current time (if there aren't any before the current time, then use the last one). Then make sure the thread open state is the same as that record calls for. But I don't have time to work out the details.
I guess if you're allowing down to the minute then you need a cron job scheduled to run every minute.
Easy5s.net
06-26-2015, 03:23 AM
pls move thread to Modification Requests/Questions (Unpaid). thanks
pls move thread to Modification Requests/Questions (Unpaid). thanks
Moved.
I assume that your question in the other thread about running scheduled tasks every minute was about this mod? It would be a concern if you don't have a lot of traffic that someone might show up some time after the thread should be open and see it closed. Maybe instead what you could do is, whenever anyone creates or edits a thread that includes open/close instructions, calculate the next time a thread has to open or close then save that time and threadid in the datastore. Then on the showthread page, check that value and open or close the thread being displayed if necessary (and recalculate the next thread/time). I guess you'd also need to do it on the forum display if you want the thread open/close icons to be right.
Easy5s.net
06-27-2015, 12:17 PM
I wrote the script cron file and it works fine if I press the Run button in the Scheduled Task Manager. But it does not work properly when I set it to run every minute. :(
I wrote the script cron file and it works fine if I press the Run button in the Scheduled Task Manager. But it does not work properly when I set it to run every minute. :(
What doesn't work right, it doesn't run? As was mentioned in the other thread, you need active forum users to get the tasks to run, so maybe that's the problem?
Anyway, you asked in the other thread about using the OS cron instead. Sorry, if I had known it owuld be hard to find I would have searched for it myself. Anyway, in this thread: http://www.vbulletin.com/forum/forum/vbulletin-4/vbulletin-4-suggestions/401938-ability-to-run-scheduled-tasks-via-real-system-cron-[-vbiv-13733] they talk about using cron, and Wayne Luke posted a simple command to use when setting up a cron job.
But there's also this article here: https://vborg.vbsupport.ru/showthread.php?t=160514 about doing that, and someone in the last post says it still works for vb4.2.2.
Easy5s.net
06-27-2015, 12:53 PM
My files to comply with the work that I need, but the time required to do the job, it will not run because cron is not running. script file works fine when I click Run now. Because the work is checked regularly so it required to run every minute. I will try with addon https://vborg.vbsupport.ru/showthread.php?t=160514
Actually, I didn't really read enough of what that addon does. It looks like it prevents the cron img from delaying the page load, but it doesn't cause the scheduled tasks to run any more often, so i guess it isn't what you need. Sorry about that.
If you have a way of setting up actual linux cron jobs you can try what is posted in that other thread on vbulletin.com.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.