Solved

scheduled copy

Posted on 2011-02-18
6
337 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
Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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…
YESTERDAY YESTERDAY.BAT is inspired by a previous article I wrote entitled: TOMORROW.BAT (http://www.experts-exchange.com/OS/Microsoft_Operating_Systems/MS_DOS/A_4196-Advanced-Batch-File-Programming-TOMORROW-BAT.html). The crux of this batch f…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

18 Experts available now in Live!

Get 1:1 Help Now