When your got the below SQL error for restore. Exclusive access could not be obtained because the database is in use. For resolve this issue, We can kill the users or change DATABASE in Single user mode to disconnect them. 1. Kill users You can check current online users by " sp_who2 " command. Then kill the command by SPID The example is SPID has 333 and "kill 333" then it will kill the process. Here is example for hostname start with A or J or R to kill. And not kill myself. DECLARE @kill varchar(8000) = ''; SELECT @kill = @kill + 'kill ' + CONVERT(varchar(5), spid) + ';' FROM master..sysprocesses WHERE spid <> @@spid AND (hostname like 'A%' OR hostname like 'J%' OR hostname like 'R%') EXEC(@kill); 2. change DATABASE in single user mode here is example for AdventureWorks DB, change name ALTER DATABASE AdventureWorks SET SINGLE_USER WITH ROLLBACK IMMEDIATE GO RESTORE DATABASE AdventureWorks FROM DISK = ...
1. open your text editor 2. Directory remove for 3 days ago at "/volume1/recording" #!/bin/sh find "/volume1/recording"- type d -mtime +3 -exec rm -rf{} \; for 50 days ago #!/bin/sh find "/volume1/recording"- type d -mtime +50 -exec rm -rf{} \; 3. File remove for 3 days ago #!/bin/sh find "/volume1/recording"- type f -mtime +3 -exec rm -rf{} \; 4. Save file as "auto_del.sh" sh file is for script. 5. Synology control panel - job scheduler - user defined script add here.