?
Solved

scheduled copy

Posted on 2011-02-18
6
Medium Priority
?
348 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
Fill in the form and get your FREE NFR key NOW!

Veeam is happy to provide a FREE NFR server license to certified engineers, trainers, and bloggers.  It allows for the non‑production use of Veeam Agent for Microsoft Windows. This license is valid for five workstations and two servers.

 
LVL 39

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 2000 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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

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

I've always wanted to allow a user to have a printer no matter where they login. The steps below will show you how to achieve just that. In this Article I'll show how to deploy printers automatically with group policy and then using security fil…
Setting up a Microsoft WSUS update system is free relatively speaking if you have hard disk space and processor capacity.   However, WSUS can be a blessing and a curse. For example, there is nothing worse than approving updates and they just have…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

750 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