Skip to content

Commit

Permalink
Merge pull request #28 from sudiptob2/patch/27-cronjob-notification
Browse files Browse the repository at this point in the history
Patch/27 cronjob notification
  • Loading branch information
sudiptob2 authored Sep 28, 2022
2 parents 204938b + 63b9b0c commit d2c56b5
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 5 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,9 @@ Feature:
Fix:

- Null notification sent when problem difficulty is not in the target difficulty fixed.


## 1.0.1 (Alpha)

Fix:

- Notification not working when `leeteasy` is scheduled with cronjob
14 changes: 12 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,20 @@ To stop leeteasy
```shell
python -m leeteasy stop
```
> **_NOTE:_** By default `leeteasy` checks for scheduled task in every 10 minutes/600 seconds.
> So there might be 10 minutes delay from the actual scheduled time while getting the notification. However,
> **_NOTE:_** By default `leeteasy` checks for scheduled task in every 1 hour/3600 seconds.
> So there might be 1-hour delay from the actual scheduled time while getting the notification. However,
> this can be controlled using `--sleep_duration` option.
## Linux cronjob guide
Set a cronjob to automatically start `leeteasy` at system boot.
```shell
# open cronjob editor
crontab -e

# add the following line
@reboot python -m leeteasy start 14:30 &

```
## Contribution guideline

If you like this project and want to improve by adding features, fixing bugs or anything, please follow
Expand Down
4 changes: 3 additions & 1 deletion leeteasy/__main__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import pwd
import time as clock

import click
Expand All @@ -17,7 +18,7 @@
)
@click.option(
"--sleep_duration",
default=600,
default=3600,
type=click.IntRange(1, 3600, clamp=True),
help='Sleep duration in seconds.'
)
Expand Down Expand Up @@ -53,4 +54,5 @@ def execute_root():
execute_root.add_command(execute_stop)

if __name__ == '__main__':
os.environ['DBUS_SESSION_BUS_ADDRESS'] = f'unix:path=/run/user/{pwd.getpwuid(os.getuid()).pw_uid}/bus'
execute_root()
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = leeteasy
version = 1.0.0
version = 1.0.1
author = Sudipto Baral
author_email = [email protected]
description = Desktop notification of easy daily challenge of leetcode.
Expand Down

0 comments on commit d2c56b5

Please sign in to comment.