Giter Club home page Giter Club logo

keep-mega-alive's Introduction

Keep-MEGA-Alive

A script to keep your mega account(s) alive and print their used storage info (df -h).

Automatically logs every run in the ~/keep-mega-alive.log file (since v1.2)

Installation

1. Install MEGAcmd

Get it from https://mega.io/cmd or using APT

Using APT (Debian/Ubuntu)

The advantage of doing it this way is that updates of MEGAcmd will be automatically fetched and installed when you upgrade your packages.

Add the MEGA signing key for the repository

curl -fsSL https://mega.nz/keys/MEGA_signing.key | sudo apt-key add -

Add the repo, replace <OS> with your OS version path found under https://mega.nz/linux/MEGAsync/

sudo echo "deb https://mega.nz/linux/MEGAsync/<OS>/ ./" > /etc/apt/sources.list.d/mega-nz.list

Then just install it

sudo apt update
sudo apt install megacmd

2. Download the script

From your home directory (~), download the latest version of the script and make it executable

curl -O https://raw.githubusercontent.com/3ncod3/keep-mega-alive/main/keep-mega-alive.sh
chmod u+x keep-mega-alive.sh

3. Create the logins file

Create a mega-logins.csv CSV file with your mega logins, with each email and password being separated by a comma and on a separate line, under your home directory like so:

Windows

For Windows, download and use the keep-mega-alive.bat file instead of the keep-mega-alive.sh file everywhere.

https://raw.githubusercontent.com/3ncod3/keep-mega-alive/main/keep-mega-alive.bat

Upgrade

Upgrade your current version of the script by simply re-downloading it

curl -O https://raw.githubusercontent.com/3ncod3/keep-mega-alive/main/keep-mega-alive.sh
chmod u+x keep-mega-alive.sh

Usage

Once you have created mega-logins.csv in your home directory and the script is executable (see Installation), just run it:

~/keep-mega-alive.sh

Specify logins file path

By default, the script is going look for the mega-logins.csv file under the same directory the script resides under but you can specify a path to this file like so:

~/keep-mega-alive.sh path/to/logins-file.csv

Schedule regular runs

You can use crontab to schedule the script to run at a regular interval by adding an entry to your cronfile (run crontab -e).

Run every month

0 0 1 * * path/to/keep-mega-alive.sh &>/dev/null

Run every other month

0 0 1 */2 * path/to/keep-mega-alive.sh &>/dev/null

Run every 3rd month

0 0 1 */3 * path/to/keep-mega-alive.sh &>/dev/null

Parse log file for login errors

The script logs everything in the file keep-mega-alive in your home directory. If you want to look at unsuccessful login attempts run

cat  ~/keep-mega-alive.log | grep ERROR

Version

Find your script version by running

~/keep-mega-alive.sh --version

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.