meganz / MEGAcmd

Command Line Interactive and Scriptable Application to access MEGA
Other
1.92k stars 406 forks source link

Correct autostart options #88

Open mitya12342 opened 6 years ago

mitya12342 commented 6 years ago

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?

polmr commented 6 years ago

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)

mat-m commented 5 years ago

Any update on this ?

polmr commented 5 years ago

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

mega-bug commented 4 years ago

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

mlipmanx commented 4 years ago

Has it been addressed as yet?

goooroooX commented 4 years ago

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

hibare commented 3 years ago

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.

yurividal commented 3 years ago

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

hibare commented 3 years ago

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.

yurividal commented 3 years ago

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

hibare commented 3 years ago

Thanks better than mine

yurividal commented 3 years ago

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
gabriellovate commented 3 years ago

Any clue on how to achieve this on Windows 10?

waldry commented 6 months ago

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.

systemdlete commented 4 months ago

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.