meganz / MEGAcmd

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

webdav: connection refused with cron job when user is not connected #958

Open alexdibella opened 3 months ago

alexdibella commented 3 months ago

Hi,

I am running megacmd on my ubuntu server and I am serving a specific folder with webdav on the same machine. I wrote a script to backup some data to the served folder (via rsync, if that matters).

I have the following situation:

Any idea what could go wrong?

edit: if it helps, the same happens with overnight backups set up via mega-cmd backup. The files are uploaded to the cloud only when I ssh into my server to check in the morning...

vibhavp commented 2 months ago

Hello,

What likely is happening here is that the mega-cmd-server instance running in the background gets terminated once you log out of your SSH session. The server process is needed for WebDAV and mega-backup to function.

Could you please try running nohup mega-cmd-server & before launching MEGAcmd, and then log out and see if the issue still persists? Thanks!

alexdibella commented 2 months ago

Hi,

That did not work. However, it did work when I left a byobu detached session open and logged out.

Do you have any idea why this could happen? mega-cmd-server should be running no matter if a user is logged in or not.

vibhavp commented 2 months ago

mega-cmd-server is launched as in the background when you run mega-cmd-shell. That process is likely also being asked to quit as your user session gets closed on exiting ssh. By always running an active session using a detached byobu instance, that guarantees that mega-cmd-server does not exit, which as a result keeps the WebDAV and mega-backup sessions alive.