Skip to content

Commit d2c56b5

Browse files
authored
Merge pull request #28 from sudiptob2/patch/27-cronjob-notification
Patch/27 cronjob notification
2 parents 204938b + 63b9b0c commit d2c56b5

File tree

4 files changed

+22
-5
lines changed

4 files changed

+22
-5
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,9 @@ Feature:
2222
Fix:
2323

2424
- Null notification sent when problem difficulty is not in the target difficulty fixed.
25-
25+
26+
## 1.0.1 (Alpha)
27+
28+
Fix:
29+
30+
- Notification not working when `leeteasy` is scheduled with cronjob

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,20 @@ To stop leeteasy
3030
```shell
3131
python -m leeteasy stop
3232
```
33-
> **_NOTE:_** By default `leeteasy` checks for scheduled task in every 10 minutes/600 seconds.
34-
> So there might be 10 minutes delay from the actual scheduled time while getting the notification. However,
33+
> **_NOTE:_** By default `leeteasy` checks for scheduled task in every 1 hour/3600 seconds.
34+
> So there might be 1-hour delay from the actual scheduled time while getting the notification. However,
3535
> this can be controlled using `--sleep_duration` option.
3636
37+
## Linux cronjob guide
38+
Set a cronjob to automatically start `leeteasy` at system boot.
39+
```shell
40+
# open cronjob editor
41+
crontab -e
42+
43+
# add the following line
44+
@reboot python -m leeteasy start 14:30 &
45+
46+
```
3747
## Contribution guideline
3848

3949
If you like this project and want to improve by adding features, fixing bugs or anything, please follow

leeteasy/__main__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import os
2+
import pwd
23
import time as clock
34

45
import click
@@ -17,7 +18,7 @@
1718
)
1819
@click.option(
1920
"--sleep_duration",
20-
default=600,
21+
default=3600,
2122
type=click.IntRange(1, 3600, clamp=True),
2223
help='Sleep duration in seconds.'
2324
)
@@ -53,4 +54,5 @@ def execute_root():
5354
execute_root.add_command(execute_stop)
5455

5556
if __name__ == '__main__':
57+
os.environ['DBUS_SESSION_BUS_ADDRESS'] = f'unix:path=/run/user/{pwd.getpwuid(os.getuid()).pw_uid}/bus'
5658
execute_root()

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = leeteasy
3-
version = 1.0.0
3+
version = 1.0.1
44
author = Sudipto Baral
55
author_email = [email protected]
66
description = Desktop notification of easy daily challenge of leetcode.

0 commit comments

Comments
 (0)