Skip to content

Instantly share code, notes, and snippets.

@arthurafarias
Last active July 28, 2023 07:31
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save arthurafarias/401ae5fbbb76a4e1e5e5 to your computer and use it in GitHub Desktop.
Save arthurafarias/401ae5fbbb76a4e1e5e5 to your computer and use it in GitHub Desktop.
Simple example script to load multiples instances of mega.co.nz client on linux.
#!/bin/sh
for d in */ ; do
HOME=$(pwd)/$d;
echo $d;
# Remove the comment by your need
# megasync # first run (configure client by client at once)
# megasync 2> /dev/null & # load all clients at non blocking way
done
@mikadoryu
Copy link

removing the # second line only shows me the list of folders where is the .sh file. As it is assumed that I have to set the path HOME?

@arthurafarias
Copy link
Author

This script will open a mega instance in every folder located in directory path of sh script is located. You should modify by you own. You have to figure out that to load multiples instances of mega you should just set $HOME variable before launching the application.

@NicoVarg99
Copy link

You might want to check out my simple script based on yout gist: https://github.com/NicoVarg99/MEGA-Instances

@arthurafarias
Copy link
Author

Cool

@hottabich676
Copy link

hottabich676 commented Jul 27, 2023

This script will open a mega instance in every folder located in directory path of sh script is located. You should modify by you own. You have to figure out that to load multiples instances of mega you should just set $HOME variable before launching the application.

Hi sir, sorry for bothering. I am trying to adjust your script to use mega-cmd instead of megasync (have a really slow notebook, so running multiple instances of megasync with the script of @NicoVarg99 loads it a lot). Can you please quickly explain how to set the $HOME variable properly? I tried to do that myself (without having any knowledge what I am doing), but stuck with only one account. For example, a have a script.sh and Folder1, Folder2 and Folder3 near it. Don`t you realise what should be changed in the script to launch 3 instances of mega-cmd? Thank you very much

@VD171
Copy link

VD171 commented Jul 27, 2023

This script will open a mega instance in every folder located in directory path of sh script is located. You should modify by you own. You have to figure out that to load multiples instances of mega you should just set $HOME variable before launching the application.

Hi sir, sorry for bothering. I am trying to adjust your script to use mega-cmd instead of megasync (have a really slow notebook, so running multiple instances of megasync with the script of @NicoVarg99 loads it a lot). Can you please quickly explain how to set the $HOME variable properly? I tried to do that myself (without having any knowledge what I am doing), but stuck with only one account. For example, a have a script.sh and Folder1, Folder2 and Folder3 near it. Don`t you realise what should be changed in the script to launch 3 instances of mega-cmd? Thank you very much

mega-cmd works for the first instance only.
You should close all mega-cmd first.

@hottabich676
Copy link

This script will open a mega instance in every folder located in directory path of sh script is located. You should modify by you own. You have to figure out that to load multiples instances of mega you should just set $HOME variable before launching the application.

Hi sir, sorry for bothering. I am trying to adjust your script to use mega-cmd instead of megasync (have a really slow notebook, so running multiple instances of megasync with the script of @NicoVarg99 loads it a lot). Can you please quickly explain how to set the $HOME variable properly? I tried to do that myself (without having any knowledge what I am doing), but stuck with only one account. For example, a have a script.sh and Folder1, Folder2 and Folder3 near it. Don`t you realise what should be changed in the script to launch 3 instances of mega-cmd? Thank you very much

mega-cmd works for the first instance only. You should close all mega-cmd first.

So its impossible to run 3 instances of mega-cmd simultaneously, am I right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment