Skip to content

Instantly share code, notes, and snippets.

@iamnimnul
Last active February 9, 2025 10:15
Show Gist options
  • Select an option

  • Save iamnimnul/64953db3d1c1b3c3a99dd6b086c9678b to your computer and use it in GitHub Desktop.

Select an option

Save iamnimnul/64953db3d1c1b3c3a99dd6b086c9678b to your computer and use it in GitHub Desktop.

Revisions

  1. iamnimnul revised this gist Feb 9, 2025. 1 changed file with 4 additions and 0 deletions.
    4 changes: 4 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,7 @@
    Install mega-cmd from official website https://mega.io/cmd#download. For Raspberry Pi use Linux > Raspbian.

    To create background service:

    ```bash
    # Create the service file (copy content)
    # WARNING: UPDATE LINE 7 "User=root" if you want to run it as different user
  2. iamnimnul created this gist Feb 9, 2025.
    29 changes: 29 additions & 0 deletions README.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    ```bash
    # 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
    ```
    15 changes: 15 additions & 0 deletions mega.service
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    [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