how can i find out what the server.sh is doing exactly?
Enable debugging in ispconfig and then run /usr/local/ispconfig/server/server.sh command as root user on the shell.
The script always runs as root, so its not a permission issue.
Your problem is mots likely related to the deletion of records in the ispconfig database. If you have a backup of the deleted records, you should restore them.