Skip to content

metakgp/mftp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Contributors Forks Stargazers Issues MIT License Wiki


MFTP - My Freaking Training & Placements

CDC Noticeboard on Your Mail: Where Automatic Updates Turn Chaos into Pleasure!
Report Bug · Request Feature

Table of Contents

About The Project

MFTP continuously monitors the CDC Noticeboard and forwards incoming notices to the configured email address, whether it's an individual account or a Google Group. It is also available as a service and as a cronjob on linux systems along with a heath checkup utility to monitor and notify for any errors.

Warning

This tool is completely legal, but the way you use it can get you into legal trouble. Some things you cannot do are:

  • Use this tool to send CDC notifications to any non-KGPian.
  • Use this tool on a wide scale or publicise its running instance without consent from the Placement Committee.

Please use this tool responsibly and within ethical and legal bounds. We do not promote violating company policies or laws. The extent of the punishment may very from disciplinary action by the institute to blacklisting from CDC process.

(back to top)

Using docker

To set up a local instance of the application using docker, follow the steps below.

Prerequisites

The following requirements are to be satisfied for the project to function properly:

(back to top)

Installation

  1. Clone the repository and cd into it
    git clone https://github.com/metakgp/mftp
    cd mftp
  2. Follow the installation steps for mftp with docker
  3. Follow the installation steps for mftp doctor with docker

(back to top)

Usage

image

It is mandatory to provide all of the following env variables before the docker-compose command.

  • MFTP_CONFIG: Absolute path to mftp_config directory
  • DOCTOR_CONFIG: Absolute path to doctor_config directory
  • MFTP_MODE: Mode of sending mail - --smtp, --gmail-api or --ntfy
sudo MFTP_CONFIG=/path/to/mftp_config DOCTOR_CONFIG=/path/to/doctor_config MFTP_MODE="--smtp" docker-compose up -d # Using SMTP for sending mails
sudo MFTP_CONFIG=/path/to/mftp_config DOCTOR_CONFIG=/path/to/doctor_config MFTP_MODE="--gmail-api" docker-compose up -d # Using Gmail API for sending mails
sudo MFTP_CONFIG=/path/to/mftp_config DOCTOR_CONFIG=/path/to/doctor_config MFTP_MODE="--ntfy" docker-compose up -d # Using NTFY for serving notifications

Note

There also is DOCTOR_MODE as one of the environment variables, which is optional and considers one value only --cron. We will use it in the sub-section just next.

As a cronjob

It is also possible to run these docker containers as a cronjob:

  • Comment out the line restart: unless-stopped in docker-compose.yml
  • Append --cron into the MFTP_MODE env variable and set DOCTOR_MODE to --cron as well. As follows:
    • Using Cronjob to run containers and SMTP to send mails
      sudo MFTP_CONFIG=/path/to/mftp_config DOCTOR_CONFIG=/path/to/doctor_config MFTP_MODE="--smtp --cron" DOCTOR_MODE="--cron" docker-compose up -d
    • Using Cronjob to run containers and Gmail API to send mails
      sudo MFTP_CONFIG=/path/to/mftp_config DOCTOR_CONFIG=/path/to/doctor_config MFTP_MODE="--gmail-api --cron" DOCTOR_MODE="--cron" docker-compose up -d
    • Using Cronjob to run containers and NTFY to serve notifications
      sudo MFTP_CONFIG=/path/to/mftp_config DOCTOR_CONFIG=/path/to/doctor_config MFTP_MODE="--ntfy --cron" DOCTOR_MODE="--cron" docker-compose up -d
  • Add the updated command with desired cron expression into your cronjob using crontab -e

(back to top)

Without using docker

To set up a local instance of the application without using docker, follow the steps below.

Supports:

  1. Shells
    • bash
    • zsh
  2. OS(s)
    • any *nix[GNU+Linux and Unix]

(back to top)

Prerequisites

The following requirements are to be satisfied for the project to function properly:

(back to top)

Installation

Now that the environment has been set up and configured to properly compile and run the project, the next step is to download and configure the project locally on your system.

  1. Clone the repository
    git clone https://github.com/metakgp/mftp
    cd mftp
  2. Install required dependencies
    pip3 install -r requirements.txt
  3. Follow the installation steps for mftp
  4. Follow the installation steps for mftp doctor
  5. Configure the mftp service
    For linux systems, MFTP & MFTP Doctor are available as a service and as cronjob. To configure them, execute the following commands after navigating into the root directory of the project (inside the mftp folder).
    cd service/
    ./configure-service.sh

(back to top)

Usage

image

After configuring MFTP as a service, you can use the mftp command with several options to interact with the tool as a service.
Following is the help menu for the service.

Usage: mftp [COMMAND] [OPTIONS]

Command:
  -h, --help                   Display this help and exit
  logs [OPTIONS]               Display last 25 lines of mftp log file
    Options:
      clear                    Clear the mftp log file
      NUM                      Display last NUM lines of mftp log file
  disable                      Disable mftp service
  enable                       Enable mftp service
  status                       Check status of mftp service
  restart                      Restart mftp service
  stop                         Stop mftp service
  start                        Start mftp service

  cronjob [OPTIONS]            Use mftp as a cronjob
    Options:
      enable [NUM]             Enable mftp cronjob after every NUM minutes (default is 2 minutes)
      disable                  Disable mftp cronjob
      status                   Check status of mftp cronjob

  doctor [OPTIONS]             Use mftp doctor as a cronjob
    Options:
      enable [NUM]             Enable doctor cronjob after every NUM minutes (default is 2 minutes)
      disable                  Disable doctor cronjob
      status                   Check status of doctor cronjob
      logs [OPTIONS]           Display last 25 lines of doctor log file
        Options:
          clear                Clear the doctor log file
          NUM                  Display last NUM lines of doctor log file

(back to top)

Maintainer(s)

(back to top)

Contact

📫 Metakgp - Metakgp's slack invite Metakgp's email metakgp's Facebook metakgp's LinkedIn metakgp's Twitter metakgp's Instagram

(back to top)

Additional documentation

(back to top)