Hi, I'm creating audit trace files via one procedure. Another procedure that is listed below will be used to stop currently running auditing and copy trace files to another server.


IF EXISTS (SELECT 1 FROM sysobjects WHERE name = 'sp_Turn_Audit_Off' AND type = 'P')
DROP PROC sp_Turn_Audit_Off
GO

create procedure sp_Turn_Audit_Off as

SET NOCOUNT ON
declare @TraceID int
declare @File nvarchar(255)
DECLARE @cmd VARCHAR(255)
DECLARE @remote_dir NVARCHAR(255)
set @remote_dir = '\\remote_server\some_directory'

DECLARE TRs CURSOR LOCAL FOR
select traceid, convert(nvarchar(255), value)
from ::fn_trace_getinfo(default)
where convert(nvarchar(255), value) like '%\%'
FOR READ ONLY

OPEN TRs
FETCH NEXT FROM TRs INTO @TraceID, @File
WHILE @@FETCH_STATUS = 0
BEGIN
print @TraceID
print @File
IF @TraceID = 0
BEGIN
exec sp_trace_setstatus @traceid = 1, @status = 2
SET @cmd = 'copy ''' + @File + ''' ''' + @remote_dir + ''' '

exec master.dbo.xp_cmdshell @cmd, NO_OUTPUT
END
ELSE
goto NextTR

NextTR:
FETCH NEXT FROM TRs INTO @TraceID, @File
END

CLOSE TRs
DEALLOCATE TRs

NoCursor:
RETURN

Is there any way to make it working when my remote server is a Linux box?
Should I supply a specific command for that?

Any help will be greatly appreciated.

Thanks!
Alla