nextcloud in webhosting occ findet data-Verzeichnis nicht.

  • Hallo!

    Ich bräuchte euren Rat.Ich habe nextcloud in einem webhosting Paket installiert. Nun wollte ich per ssh einen occ Befehl absetzen, um Indizes auf manchen Tabellen hinzuzufügen. Ich erhalte dabei aber folgende Fehlermeldung:

    Code
    Your data directory is invalid
    Ensure there is a file called ".ocdata" in the root of the data directory.
    
    Cannot create "data" directory
    This can usually be fixed by giving the webserver write access to the root directory. See https://docs.nextcloud.com/server/22/go.php?to=admin-dir_permissions

    Ich vermute, dass das damit zusammenhängt, dass ich per ssh ja in so einer gekapselten Umgebung auf dem Webserver lande. Denn die Datei .ocdata ist im data-Verzeichnis vorhanden. In der config.php steht:

    'datadirectory' => '/var/www/vhosts/hostingXXXXXX.afXXX.netcup.net/httpdocs/nextcloudPFad/data',

    Ich gehe davon aus, dass das der tatsächliche Pfad auf dem Dateisystem ist. Auf diesen kann ich aber halt aus meiner gekapselten Umgebung per ssh in dem Webhosting nicht zugreifen und dass da das Problem liegt.

    Nun weiß ich aber leider nicht, wie ich das Problem lösen könnte. Klar könnte ich in der config.php den Dateipfad auf /httpdocs/nextcloudPFad/data ändern und dann würde der occ Befehl vermutlich das data-Verzeichnis auch finden. Ich befürchte aber, dass der Webserver auf dem eigentlichen Wirtssystem, dann das Verzeichnis nicht mehr findet, und nextcloud dann alle Dateien für verschwunden erklärt.

    Habt ihr einen Vorschlag für mich, wie ich das risikoarm regeln könnte?

    Vielen Dank vorab!

  • Ja. KB19 hat da mal eine einfache, prima funktionierende Lösung gepostet.


    Erzeuge im config-Verzeichnis eine neue Datei, data.config.php mit folgendem Inhalt:


    PHP
    <?php
    
    $CONFIG['datadirectory'] = realpath(__dir__ . '/../data');

    Das war's dann auch schon. So ist es dann auch updatesicher.

  • Für kleinerer OCC Sachen - verwende ich gerne OCC web.

    Wurden diese Probleme mittlerweile gelöst?


    Deprecated warning


    As nextcloudd has no native support for asynchronous operations, due to the use of php, this aplication is deprecated, and will no longer support the Nextcloud' future versions (19+). I did not find a way to implemement true support for interactive and long running occ tasks in a web terminal whitout introducing addtional dependencies (through websockets, for example), the lack of true asynchronous occ operations can lead to serious alterations of voluminous instances. This issue may give some hints on why I decided to not support this application anymore.

    "Wer nur noch Enten sieht, hat die Kontrolle über seine Server verloren." (Netzentenfund)

    Edited 3 times, last by KB19 ().

  • Kleine Anmerkung noch zu dem Thema:


    Der obere Kniff mit der data.config.php um Cron-Jobs (CLI) auszuführen hat leider mein Nextcloud komplett lahmgelegt, weil Nextcloud das Datenverzeichnis nicht mehr finden konnte. Ich musste eine "Weiche" einbauen in der data.config.php:


    PHP
    <?php
    
    if ( php_sapi_name ( ) == 'cli' )
    
        $CONFIG['datadirectory'] = '/n_data';
    
    else
    
    ?>

    Dann ging es. Man kann wohl diese Weiche auch in die Config.php einbauen, aber das wollte ich nicht ausprobieren, hier wäre der Link: https://forum.netcup.de/sonsti…d-legt-weboberfl%C3%A4ch/

  • Das oben funktioniert ohne Anpassung des relativen Pfads zum Data-Verzeichnis ( im Beispiel "../data" relativ zum config-Verzeichnis) natürlich nur mit dem Standardpfad für das Data-Verzeichnis.