When running a simple job (perl script) which gets a dump from remote database directly to workspace and fills another remote database the console output shows the stack trace:
ln builds/lastSuccessfulBuild /var/jenkins_home/jobs/Redmine3-DB-Copy/lastSuccessful failed java.nio.file.DirectoryNotEmptyException: /var/jenkins_home/jobs/Redmine3-DB-Copy/lastSuccessful at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242) at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108) at java.nio.file.Files.deleteIfExists(Files.java:1165) at hudson.Util.createSymlink(Util.java:1321) at hudson.model.Run.createSymlink(Run.java:1866) at hudson.model.Run.updateSymlinks(Run.java:1847) at hudson.model.Run.execute(Run.java:1725) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) ln builds/lastStableBuild /var/jenkins_home/jobs/Redmine3-DB-Copy/lastStable failed java.nio.file.DirectoryNotEmptyException: /var/jenkins_home/jobs/Redmine3-DB-Copy/lastStable at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:242) at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108) at java.nio.file.Files.deleteIfExists(Files.java:1165) at hudson.Util.createSymlink(Util.java:1321) at hudson.model.Run.createSymlink(Run.java:1866) at hudson.model.Run.updateSymlinks(Run.java:1848) at hudson.model.Run.execute(Run.java:1725) at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:43) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:429) [EnvInject] - Loading node environment variables.