Calendar
From MLDonkey
Calendar allows you to schedule MLdonkey commands to be run periodically (like cron)
Contents |
[edit] Syntax
The calendar is stored in your Downloads.ini file and its syntax is:
calendar = [
([0;1;...;6;], [0;1;...;23;], "command1" );
([0;1;...;6;], [0;1;...;23;], "command2" );
... ]
- First parameter contains a list of days of week on which the command will be executed (
Sunday=0, Monday=1, Tuesday=2, ..., Saturday=6). - Second parameter contains a list of hours (in 24-hour format) on which the command will be executed (
0 ... 24). - The third and last parameter is the command itself.
Multiple days, hours and commands can be specified by separating them with semicolons.
[edit] Getting Started
You can quickly schedule commands to execute every day with the calendar_add command:
calendar_add hour "command"
Try using the calendar_add command before editing downloads.ini to make sure you get the formatting right.
[edit] Examples
[edit] Simple
If you run these commands:
> calendar_add 8 "set max_upload_rate 10" > calendar_add 22 "set max_upload_rate 0"
You will get the following calendar in your downloads.ini:
calendar = [
([
0;
1;
2;
3;
4;
5;
6;], [
22;], "set max_upload_rate 0");
([
0;
1;
2;
3;
4;
5;
6;], [
8;], "set max_upload_rate 10");]
Notice how mldonkey formats the calendar. It will do this every time you stop the mldonkey daemon/service.
[edit] Complicated
After some experimentation and tweaking I have come up with my personal complicated calendar. Don't try to understand what it does! This is the summary returned by the vcal command:
> vcal weekdays / hours / command : 1 2 3 4 5 6 set max_hard_download_rate 1 1 2 3 4 5 6 set max_hard_upload_rate 10 1 2 3 5 9 set max_hard_download_rate 0 1 2 3 5 9 set max_hard_upload_rate 0 4 10 set max_hard_download_rate 0 4 10 set max_hard_upload_rate 0 1 2 3 4 5 13 set max_hard_download_rate 1 1 2 3 4 5 13 set max_hard_upload_rate 10 1 2 3 4 5 22 set max_hard_download_rate 0 1 2 3 4 5 22 set max_hard_upload_rate 0 6 7 set max_hard_upload_rate 10 6 7 set max_hard_download_rate 1 6 22 set max_hard_upload_rate 0 6 22 set max_hard_download_rate 0 0 14 set max_hard_upload_rate 10 0 14 set max_hard_download_rate 1 0 20 set max_hard_upload_rate 0 0 20 set max_hard_download_rate 0
This is the actual contents of the downloads.ini file:
calendar = [
([
1;
2;
3;
4;
5;], [
6;], "set max_hard_download_rate 1");
([
1;
2;
3;
4;
5;], [
6;], "set max_hard_upload_rate 10");
([
1;
2;
3;
5;], [
9;], "set max_hard_download_rate 0");
([
1;
2;
3;
5;], [
9;], "set max_hard_upload_rate 0");
([
4;], [
10;], "set max_hard_download_rate 0");
([
4;], [
10;], "set max_hard_upload_rate 0");
([
1;
2;
3;
4;
5;], [
13;], "set max_hard_download_rate 1");
([
1;
2;
3;
4;
5;], [
13;], "set max_hard_upload_rate 10");
([
1;
2;
3;
4;
5;], [
22;], "set max_hard_download_rate 0");
([
1;
2;
3;
4;
5;], [
22;], "set max_hard_upload_rate 0");
([
6;], [
7;], "set max_hard_upload_rate 10");
([
6;], [
7;], "set max_hard_download_rate 1");
([
6;], [
22;], "set max_hard_upload_rate 0");
([
6;], [
22;], "set max_hard_download_rate 0");
([
0;], [
14;], "set max_hard_upload_rate 10");
([
0;], [
14;], "set max_hard_download_rate 1");
([
0;], [
20;], "set max_hard_upload_rate 0");
([
0;], [
20;], "set max_hard_download_rate 0");]
