Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Directory Store backup Script

Status
Not open for further replies.

Starrett

MIS
Feb 23, 2005
14
US
Hello,

I have written a script to copy my Citrix Data Store to another server daily.
I want to rename my datastore copy by the date and time.
I am having trouble appending my time variable to my file name because of a leading null character.
Name output Example: "mf20.mdb.2005-04-12_ 43355"
My file name ends up with a space in it just after the underscore when run in the morning before 10AM.
Thanks for any help.

@echo on
set lbkfile=C:\citrixds_backup
set rbkfile=\\server\U$\CITRIX_DSbackup
set dstr=%date:~10,4%-%date:~4,2%-%date:~7,2%
set tstr=%time:~0,2%%time:~3,2%%time:~7,2%
if not exist %rbkfile% md %rbkfile%
dsmaint backup %lbkfile%
net use B: \\server\U$ /persistent:no
copy %lbkfile%\mf20.mdb B:\CITRIX_DSbackup\mf20.mdb.%dstr%_%tstr%
del %lbkfile%\mf20.mdb
if exist B:\CITRIX_DSbackup\mf20.mdb.%dstr%_%tstr% (
echo Citrix Farm DataStore for the "Citrix Farm" was copied to: >>ctx
echo %rbkfile%. >>ctx
echo This is a daily backup which is recommended by Citrix in case of DataStore corruption. >>ctx
echo This script is located on the Citrix server in C:\CitrixDS_backup directory. >>ctx
set status=SUCCESSFUL
goto :mail
) else (
The Citrix DAILY Data Store Backup FAILED! >>ctx
Please check that the scheduled script on CITRIX2 ran properly. >>ctx
Please make sure that the \\server\U$\CITRIX_DSbackup path was available to copy to. >>ctx
echo This script is located on the Citrix server in C:\CitrixDS_backup directory. >>ctx
set status=FAILURE
)
:mail
pause
net use B: /delete
bmail -s 172.16.16.6 -t test@test.com -f test@test.com -a "%status%!-Citrix daily Data Store backup %dstr%_%tstr%" -m ctx -c
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top