MEGAcmd icon indicating copy to clipboard operation
MEGAcmd copied to clipboard

Correct autostart options

Open mitya12342 opened this issue 6 years ago • 15 comments

How to make mega-cmd-server run on boot? I don't see any builtin option for it. Are there any implemented way of autostart for syncs? I will go with @reboot /usr/bin/mega-cmd-server in user cron for now. Is it right?

mitya12342 avatar Sep 02 '18 04:09 mitya12342

If I'm not mistaken that would initiate the server as root. Which I understand that's not what you'd want. You might want to add an entry at $HOME/.config/autostart/megacmd.desktop. Something like:

[Desktop Entry]
Type=Application
Version=1.0
GenericName=File Synchronizer
Name=MEGAcmd
Comment=Easy automated syncing between your computers and your MEGA cloud drive.
TryExec=mega-cmd-server
Exec=mega-cmd-server
Icon=mega
Terminal=false
Categories=Network;System;
StartupNotify=false
X-GNOME-Autostart-Delay=30

We should however add the corresponding scripts to be able to run it as a service (that's in our TODO list)

polmr avatar Sep 03 '18 08:09 polmr

Any update on this ?

mat-m avatar Feb 01 '19 01:02 mat-m

This hasn't been addressed yet, but it's still in the roadmap.

polmr avatar Feb 01 '19 08:02 polmr

I made a suggestion for a similar issue at https://github.com/meganz/MEGAcmd/issues/235.

mega-bug avatar Nov 09 '19 15:11 mega-bug

Has it been addressed as yet?

mlipmanx avatar Jul 18 '20 11:07 mlipmanx

I'm also interested in running mega-cmd-server as daemon.

goooroooX avatar Jul 21 '20 15:07 goooroooX

Looking forward for this option, right now working on a script which can start mega server if its not already running, so my daily backup is not disturbed.

hibare avatar Oct 05 '20 04:10 hibare

Looking forward for this option, right now working on a script which can start mega server if its not already running, so my daily backup is not disturbed.

Did you manage to get the script to auto-start mega-cmd ? do you mind sharring? My backups are being stoped

yurividal avatar Dec 11 '20 20:12 yurividal

backup is set using the command specified on mega site. My only problem was mega process was not running whenever server restarts.

Solution I found was, shell script which checks for mega process, if its not running, starts it.

Here is the script link https://github.com/hibare/Rapler-Scripts/blob/master/process_monitor.sh

Schedule a cron job for this script. Mine is set to run every hour as I don't want to miss regular backups.

Have been using it from last couple of months, does the job just fine.

hibare avatar Dec 26 '20 08:12 hibare

My solution was to create a systemd service for megacmd, and set enable it. Works like charm.

yurividal avatar Dec 26 '20 09:12 yurividal

Thanks better than mine

hibare avatar Dec 26 '20 09:12 hibare

Create a file in "/etc/systemd/system/mega-cmd.service" containing:

[Unit]
Description=Mega-CMD systemd service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=on-failure
RestartSec=1
User=pi
ExecStart=/usr/bin/mega-cmd-server

[Install]
WantedBy=multi-user.target

Then run

# systemctl start mega-cmd
# systemctl enable mega-cmd

yurividal avatar Dec 26 '20 10:12 yurividal

Any clue on how to achieve this on Windows 10?

gabriellovate avatar Aug 18 '21 19:08 gabriellovate

Create a file in "/etc/systemd/system/mega-cmd.service" containing:

[Unit]
Description=Mega-CMD systemd service
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=on-failure
RestartSec=1
User=pi
ExecStart=/usr/bin/mega-cmd-server

[Install]
WantedBy=multi-user.target

Then run

# systemctl start mega-cmd
# systemctl enable mega-cmd

This Solve my situation like those persons in this issue. Just replace the user and now the service is always running and start and any server restart.

waldry avatar Mar 09 '24 14:03 waldry

If I'm not mistaken that would initiate the server as root.

only if that were root's crontab. I have the mega users's crontab set up this way (with the @reboot) and it works fine.

systemdlete avatar Apr 18 '24 21:04 systemdlete