Run-script-before on Debian

I’m a relative novice but have read the various forums and I cannot find a way to run a script that uses the ‘run-script-before’ and a script after backup. Before my weekly backup of Debian I’m looking to stop Home Assistant running within VirtualBox and then restart it once the backup is completed but the error keeps saying ‘file not found’. My script is executable and I can run it locally on my Debian system or remotely via SSH

Script - /home/simon/‘VirtualBox VMs’/Home_Assistant/./homeassistant.stop

#! /bin/bash
VBoxManage controlvm “Home_Assistant” poweroff --type headless

Error:

  • 2022-11-21 20:04:52 +00 - [Warning-Duplicati.Library.Modules.Builtin.RunScript-ScriptExecuteError]: Error while executing script “/home/simon/‘VirtualBox VMs’/Home_Assistant/./homeassistant.stop”: ApplicationName=‘/home/simon/‘VirtualBox VMs’/Home_Assistant/./homeassistant.stop’, CommandLine=‘’, CurrentDirectory=‘’, Native error= Cannot find the specified file

I’ve moved the executable script to another folder without a space in as well to rule this out but still the same error. I’m sure this must be a simple formatting error so any guidance/assistance greatly appreciated.

Thanks in advance

Hello

no specific idea, but did you try to canonicalize the script name, that is, remove the relative part in it like from:

/home/simon/‘VirtualBox VMs’/Home_Assistant/./homeassistant.stop

to

/home/simon/‘VirtualBox VMs’/Home_Assistant/homeassistant.stop

maybe there is a problem with that ? it is not an usual way to give a path.

Welcome to the forum @SiMoore

Did you then drop the single quotes? Are those there just to help the shell, so not in folder name?
They seem to have made it into the warning message. How exactly was that message obtained?

The script references are a little confusing. Is Duplicati backup itself being run from script or GUI?
If GUI, don’t quote (e.g. on Options screen) as you normally might for a shell. Give the actual path.

Thanks that was half of the problem solved, I then had to add in a line to the script which I found from a Google search and now it works so the end result is as follows:

–run-script-before=/home/simon/VirtualBox VMs/Home_Assistant/./homeassistant.stop

Script:
#! /bin/bash
export VBOX_USER_HOME=/home/simon/.config/VirtualBox
VBoxManage controlvm “Home_Assistant” poweroff --type headless

–run-script-after=/home/simon/VirtualBox VMs/Home_Assistant/./homeassistant.start

Script:
#! /bin/bash
export VBOX_USER_HOME=/home/simon/.config/VirtualBox
VBoxManage startvm “Home_Assistant” --type headless

As well as formatting as thankfully corrected it then had a user permissions issue. With the additional ‘export’ line in the script this has fixed the problem so now it successfully closes Home Assistant, takes a backup and then once completed it starts the VM again

Thanks again

1 Like