Skip to content

Commit

Permalink
Merge pull request #1 from Epiteks/dev
Browse files Browse the repository at this point in the history
v1.0
  • Loading branch information
hug33k authored Sep 5, 2017
2 parents 716e263 + f020f00 commit 8dd8646
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 13 deletions.
30 changes: 30 additions & 0 deletions Dockerfile
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
47 changes: 34 additions & 13 deletions README.md
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

Expand All @@ -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 ?

Expand Down
1 change: 1 addition & 0 deletions crontab
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
*/2 * * * * python $NOTIFYSMS_DIR/main.py

0 comments on commit 8dd8646

Please sign in to comment.