kosdk/megacmd

By kosdk

Updated 10 months ago

Mega.nz megacmd for ARM, 386 and AMD64.

Image
Databases & Storage
Networking

3.2K

Mega.nz megacmd

Container for ARMv7, 386 and amd64 with some extra functionality to help with periodic backups.

View Git Repository.

Environment Variables

NameDescription
USERNAMEThe mega account username. Required if SESSION not supplied.
PASSWORDThe mega account password. Required if SESSION not supplied.
SESSIONThe mega login session. Required if USERNAME and PASSWORD not supplied.
MEGACMDThe command to pass to the megacmd program. You don't need to prefix the mega- to the command. Required.
INTERVALThe time in minutes to repeat the command. Leave blank or set to 0 exit immediately.
BEGINThe time in HHMM UTC to first run the command. If not set will run immediately.

You can add _FILE to the end of any environment variable to set the variable from a file. Typically used for secrets.

If the BEGIN command is set, then the INTERVAL will be set to 1440 (one day) automatically. If you want to override this then set INTERVAL to the delay you want (you can also set it to 0 to exit immediately).

For a list of program commands and user guide, visit https://github.com/meganz/MEGAcmd/blob/master/UserGuide.md

Usage

To run help (one-off)

docker run -d \
-e USERNAME=<yourmegausername> \
-e PASSWORD=<yourmegapassword> \
-e MEGACMD=help \
kosdk/megacmd

To upload a folder every day from the host machine

docker run -d \
-v /backup:/hostpathtofolder
-e SESSION=<sessionid> \
-e INTERVAL=1440
-e MEGACMD="put /backup/* /backup/server/" \
kosdk/megacmd

Session IDs

It is recommended to use the SESSION_FILE environment variable to read a session secret from docker secrets/file instead of exposing your username and password.

To generate a session id, you can run the container with following:

docker run --rm \
-e USERNAME=<yourusername> \
-e PASSWORD=<yourpassword> \
-e MEGACMD="session" \
kosdk/megacmd

You will see the session secret in the output.

Docker Pull Command

docker pull kosdk/megacmd