Hi, I am having an issue running ZAP multiple times to generate a report. I can run ZAP in command line in Kali Linux using the following command.
owasp-zap -daemon -quickurl
https://example.com /home/kali/owasp/$(date +\%d.%m.%y-)Report.html
This command works fine so, what i have done is put this command in a script file to run via cron job say twice a week for E.G.
My cron job will run once then when it comes to running again ZAP has an issue where it fails to start main proxy and i get the following errors.
org.zaproxy.addon.network.ExtensionNetwork - Failed to start the main proxy: java.net.BindException Address already in use
17434 [ZAP-daemon] ERROR org.parosproxy.paros.CommandLine - Terminating ZAP, unable to start the main proxy.
27743 [ZAP-daemon] ERROR DataNucleus.Datastore.Schema - Failed initialising database.
org.datanucleus.exceptions.NucleusDataStoreException: Database lock acquisition failure: lockFile: org.hsqldb.persist.LockFile@7ebdd70d[file =/home/kali/.ZAP/db/permanent.lck, exists=true, locked=false, valid=false, ] method: checkHear
When I load the Owasp Zap app I get this. If I click yes to use port 8091 my cron job will then run again but only once then the same issue happens again.

I have tried going into the app and manually setting the proxy to port 8080 but it still happens, I have also tried different versions of ZAP but get the same issue.
Dose anyone know how to fix this?