Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

scheduled copy

Posted on 2011-02-18
6
Medium Priority
?
347 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

TOMORROW TOMORROW.BAT is inspired by a question I get asked over and over again; that is, "How can I use batch file commands to obtain tomorrow's date?" The crux of this batch file revolves around the XCOPY command - a technique I discovered w…
Being a system administrator some time we require to do things remotely, one of them is installing software. Here I am going to tell you how to install software through wmic (Windows management instrument console). I am not at all saying that this i…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
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.…
Suggested Courses

618 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