-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from Epiteks/dev
v1.0
- Loading branch information
Showing
3 changed files
with
65 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
FROM python:3.5-alpine | ||
|
||
MAINTAINER hug33k | ||
|
||
ENV SMS_LOGIN login | ||
ENV SMS_TOKEN token | ||
ENV EPITECH_MAIL mail | ||
ENV EPITECH_PWD pwd | ||
ENV NOTIFYSMS_DIR /app | ||
|
||
RUN echo "http://dl-2.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \ | ||
echo "http://dl-3.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \ | ||
echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories; \ | ||
echo "http://dl-5.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories | ||
|
||
RUN apk update; apk add apk-cron | ||
|
||
RUN mkdir /app | ||
|
||
COPY . /app/ | ||
|
||
RUN crontab -l | cat - /app/crontab | crontab - | ||
|
||
RUN touch /var/log/cron.log | ||
|
||
RUN pip install -r /app/requirements.txt | ||
|
||
WORKDIR /app | ||
|
||
CMD crond && tail -f /var/log/cron.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,71 @@ | ||
# NotifySMS | ||
|
||
[![](https://images.microbadger.com/badges/version/epiteks/notifysms.svg)](https://microbadger.com/images/epiteks/notifysms) | ||
|
||
🔔 ➡ 📱 Get Epitech notifications by SMS via Free Mobile | ||
|
||
## How to use it ? | ||
|
||
#### Setup | ||
### Via Docker | ||
|
||
Via CLI : | ||
|
||
````bash | ||
$> docker run -d -e "SMS_LOGIN=login" -e "SMS_TOKEN=token" -e "EPITECH_MAIL=mail" -e "EPITECH_PWD=pwd" epiteks/notifysms | ||
```` | ||
|
||
Via Docker Compose : | ||
````yaml | ||
notifysms: | ||
image: epiteks/notifysms | ||
environment: | ||
- SMS_LOGIN | ||
- SMS_TOKEN | ||
- EPITECH_MAIL | ||
- EPITECH_PWD | ||
restart: always | ||
```` | ||
|
||
### Local | ||
|
||
You need to set these variables into your environment : | ||
- NOTIFYSMS_DIR | ||
- SMS_LOGIN | ||
- SMS_TOKEN | ||
- EPITECH_MAIL | ||
- EPITECH_PWD | ||
|
||
`NOTIFYSMS_DIR` is the location of `NotifySMS` directory. | ||
|
||
`SMS_*` are used by [`freemobilesms`](https://github.com/hug33k/freemobilesms). | ||
You can get these infos in your [Free Mobile panel](https://mobile.free.fr/moncompte/) | ||
|
||
`EPITECH_*` are used to log you in via [our wrapper](https://github.com/epiteks/wrapitech). | ||
|
||
Example : | ||
````bash | ||
export NOTIFYSMS_DIR=`pwd` | ||
export SMS_LOGIN=xxxxxxx | ||
export SMS_TOKEN=xxxxxxx | ||
export [email protected] | ||
export SMS_TOKEN=unix_pwd | ||
```` | ||
|
||
Then you will need to install needed packages via [`pip`](https://pip.pypa.io/en/stable/installing/). | ||
|
||
````bash | ||
$> pip install -r requirements.txt | ||
```` | ||
|
||
#### Let's run it | ||
|
||
You will have to add a line to your `crontab` config. | ||
If you want to execute this program regularly, you can use cron. | ||
Command is available in `crontab`[crontab]. | ||
|
||
````sh | ||
$> crontab -e | ||
```` | ||
|
||
Then you need to add this (Based on how often you want to run it and where `NotifySMS` is located on your computer) : | ||
|
||
```` | ||
*/15 * * * * python3.5 $PATH_TO_NOTIFYSMS/main.py | ||
$> crontab -l | cat - crontab | crontab - | ||
```` | ||
|
||
(Here, it will run every 15 minutes `NotifySMS`, which is at $PATH_TO_NOTIFYSMS` location) | ||
This configuration will ask cron to execute `NotifySMS` every 2 minutes. | ||
You can change it before execute this command. | ||
|
||
## FAQ | ||
|
||
|
@@ -58,7 +79,7 @@ But feel free to contribute ! | |
|
||
Unfortunately, we don't support OAuth with [Wrapitech](https://github.com/epiteks/wrapitech). | ||
|
||
Once again, feel free to contribute !` | ||
Once again, feel free to contribute ! | ||
|
||
#### What is `history.json` ? Can I delete it ? | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*/2 * * * * python $NOTIFYSMS_DIR/main.py |