Solved

scheduled copy

Posted on 2011-02-18
6
338 Views
Last Modified: 2012-05-11
i have a very simple batch i would like to run each day on a windows 2003 server. this is what is in the batch
cd \
sleep 3
cd sqlbackup
sleep 3
copy *.bak z:\ /Y
sleep 3
i created a schedule for this to run everyday, and according to windows it runs, but it really isn't running because my files are not being copied. i suspect that this isn't working because it needs a dos prompt and when i am not logged in, there isn't a dos prompt for these commands to run in. i say this because i was logged into this server once when the schedule was set to run, and a dos window opened and the batch ran. however, when i am not logged in, windows schedule task reports that it runs, but i look at the destination where the files should be copied, and the files are not there. is there some way to run these simple commands without being logged in?
0
Comment
Question by:JeffBeall
6 Comments
 
LVL 33

Expert Comment

by:knightEknight
ID: 34927032
Most likely it is a permissions issue.  Make sure the task is running as a user that has read-write permissions to the target directory.
0
 
LVL 4

Expert Comment

by:loki_loki
ID: 34927053
you shouldn't need to do the directory changes manually, just use the full path i.e.
copy c:\sqlbackups\*.* d:\*.bak /Y

that should work regardless of whether you are logged on, as long as the account that you choose tin the scheduled task has the correct permissions for the folders.
0
 
LVL 33

Expert Comment

by:knightEknight
ID: 34927054
Also, if Z: is mapped to a network drive, you may want to specify the target as a UNC instead of a drive\directory:

copy *.bak  \\server\c$  /Y
0
Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

 
LVL 38

Expert Comment

by:Aaron Tomosky
ID: 34927202
Switch to robocopy. It will give you good errors if there is a problem
0
 
LVL 14

Accepted Solution

by:
Don Thomson earned 500 total points
ID: 34938980
If you are not logged in - a Batch file is not going to run.
There are methods to make any program run as a service
See http://e-articles.info/e/a/title/How-to-Run-your-Own-Program-as-a-Service-in-Windows/

It uses the Windows 2000 Resource Kit

If you are just doing a bakup of specific files and folders - to another location - why don't you just use NTBackup.exe - Not only do you get a copy - you can set it up to do multiple days in the same file - then on a regular basis - rename the backup files and archive them on DVD or something similar

If it's just a single daily copy you want - Just overwrtie the Bckup copy - If you need to have the actual files on the other drive or location - Just do a restore from the backup file

0
 
LVL 1

Author Closing Comment

by:JeffBeall
ID: 34939151
Thanks for the help. I can't beleive i didn't think of NTBackup, that is working fine. I guess i over thought this.
0

Featured Post

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Best practices power settings GPO Win 10 4 82
AD user acount change history 4 64
How to restore security permissions on a file server 4 34
SBS 2003 RWW Login 3 13
This may not be a text book method to resolve VSS backup issues but it seemed to have worked on few of the Windows 2003 servers we had issues while performing a Volume Shadow Copy backup. If you have issues while performing a shadow copy backup usin…
VALIDATING DATES One method of validating dates is to jam the date into the DATE command and see if it accepts it by examining the system's errorlevel value. A non-zero result indicates failure. A typical example might look something like the fol…
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.
A company’s greatest vulnerability is their email. CEO fraud, ransomware and spear phishing attacks are the no1 threat to a company’s security. Cybercrime is responsible for the largest loss of money to companies today with losses projected to r…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now