Solved

scheduled copy

Posted on 2011-02-18
6
344 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

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

Comparison of Amazon Drive, Google Drive, OneDrive

What is Best for Backup: Amazon Drive, Google Drive or MS OneDrive? In this free whitepaper we look at their performance, pricing, and platform availability to help you decide which cloud drive is right for your situation. Download and read the results of our testing for free!

Question has a verified solution.

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

Many of us need to configure DHCP server(s) in their environment. We can do that simply via DHCP console on server or using MMC snap-in on each computer with Administrative Tools installed in a network. But what if we have to configure many DHCP ser…
ADCs have gained traction within the last decade, largely due to increased demand for legacy load balancing appliances to handle more advanced application delivery requirements and improve application performance.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

717 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