Skip to content

Instantly share code, notes, and snippets.

@Silenoid
Forked from iamnimnul/README.md
Last active December 29, 2025 21:19
Show Gist options
  • Select an option

  • Save Silenoid/97f6c6369a9176d9be689aaf9bfec1ea to your computer and use it in GitHub Desktop.

Select an option

Save Silenoid/97f6c6369a9176d9be689aaf9bfec1ea to your computer and use it in GitHub Desktop.
Install mega-cmd on Linux and making mega-cmd-server service running by itself
[Unit]
Description=Mega CMD Server
After=network.target
[Service]
Type=simple
User=root
ExecStart=/usr/bin/mega-cmd-server
Restart=on-failure
RestartSec=5
StandardOutput=append:/var/log/mega.log
StandardError=append:/var/log/mega-error.log
[Install]
WantedBy=multi-user.target

Install megacmd-bin from AUR.

Use the mega-cmd functions to login, sync stuff. Every time you'll run it, the mega-cmd-server will be started, but also stopped when exiting the mega-cmd console, not synching in background. In order to do that, make the mega-cmd-server command as a systemd service:

# Create the service file (see mega.service) and update "User=<your own user>"
sudo nano /etc/systemd/system/mega.service
sudo chmod 644 /etc/systemd/system/mega.service
sudo systemctl daemon-reload
sudo systemctl enable mega
sudo systemctl start mega

# Other useful commands 
# Check status
sudo systemctl status myservice
# Stop service
sudo systemctl stop myservice
# Restart service
sudo systemctl restart myservice
# View logs
journalctl -u myservice
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment