OMV\ExecException: Failed to execute command with exit code 2

  • Hi Guys,


    I have some trouble executing the following command as planned task:


    Code
    read -r -d $'\0' line < <(find/srv/dev-disk-by-label-Data-RAID/@data/.@snapshots -maxdepth 1 -type d -printf'%T@ %p\0' | sort -z -n) && file="${line#* }" && btrfs subvolume delete $file


    This ugly one-liner should delete the oldest snapshot on my Data-RAID. But when I'am trying to run this task, I get the following error message:

    Code
    OMV\ExecException: Failed to execute command 'export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin; export LANG=C; export SHELL=/bin/sh; sudo --shell --non-interactive --user=root -- read -r -d $'\0' line < <(find /srv/dev-disk-by-label-Data-RAID/@data/.@snapshots -maxdepth 1 -type d -printf '%T@ %p\0' | sort -z -n) && file="${line#* }" && btrfs subvolume delete $file 2>&1' with exit code '2': in /usr/share/openmediavault/engined/rpc/cron.inc:175


    But, I dont't know where the problem is. Maybe you've got an idea :D ?!

  • export SHELL=/bin/sh

    You're using bash syntax in your command while OMV uses sh. I would try to put the whole code in a little script reading


    Bash
    #!/bin/bash
    read -r -d $'\0' line < <(find/srv/dev-disk-by-label-Data-RAID/@data/.@snapshots -maxdepth 1 -type d -printf'%T@ %p\0' | sort -z -n) && file="${line#* }" && btrfs subvolume delete $file

    and then let the script execute as planned task.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!