Skip to content

Instantly share code, notes, and snippets.

@iamnimnul
Last active February 9, 2025 10:15
Show Gist options
  • Save iamnimnul/64953db3d1c1b3c3a99dd6b086c9678b to your computer and use it in GitHub Desktop.
Save iamnimnul/64953db3d1c1b3c3a99dd6b086c9678b to your computer and use it in GitHub Desktop.
Installing mega-cmd-server service on Debian 12 / Raspberry Pi OS

Install mega-cmd from official website https://mega.io/cmd#download. For Raspberry Pi use Linux > Raspbian.

To create background service:

# Create the service file (copy content)
# WARNING: UPDATE LINE 7 "User=root" if you want to run it as different user
sudo nano /etc/systemd/system/mega.service

# Set proper permissions
sudo chmod 644 /etc/systemd/system/mega.service

# Reload systemd to recognize the new service
sudo systemctl daemon-reload

# Enable the service to start on boot
sudo systemctl enable mega

# Start the service
sudo systemctl start mega

# Check status
sudo systemctl status myservice

# Stop service
sudo systemctl stop myservice

# Restart service
sudo systemctl restart myservice

# View logs
journalctl -u myservice
[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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment