Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
|
|
#1 | Link |
|
clueless n00b
![]() Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,256
|
soon.exe experts wanted
I'm trying to automate mirroring of certain directories on my HD using robocopy. Towards that end I created the following batchfile called backup.cmd:
Code:
robocopy c:\test1 c:\test2 /secfix /mir soon 300 backup Now when I execute the script first robocopy runs, then it schedules a new run, but instead of right now plus 5 minutes the task is being scheduled for this time tomorrow plus 5 minutes, so essentially the task is put one day in the future. The 2nd problem is that when the task is due it doesn't complete.. when I run at it shows tasks in the past as having errors.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
|
|
|
|
#2 | Link |
|
Registered User
Join Date: Oct 2001
Location: /home/tactx/
Posts: 367
|
Try renaming 'backup' to 'backup.cmd':
soon 300 backup.cmd it _should_ work then... Don't ask me why, it just seems like if 'soon' gets something wrong if you don't add the .cmd ![]() EDIT: I forgot to mention that your backup.cmd needs to be in c:\winnt or any directory with a path to it. But I highly doubt that the almighty doom would make such a mistake
__________________
Quoted from an FAQ at the linux-wlan project: "If a given distribution chooses to do something funky, we rely on users of that distribution to contribute patches to deal with their funkiness." Last edited by TactX; 17th January 2003 at 20:13. |
|
|
|
|
|
#3 | Link | |
|
Registered User
Join Date: Oct 2001
Location: Alabama, USA
Posts: 718
|
I needed to do the the same thing for my job here at the library and make sure some digital photos where backed up to a Snap drive (160 gig network drive). I happened to come accross this interesting program made by some guy at Microsoft and written in C#. It is called FileSync and the full sourcecode is available. I believe if you used it in conjuction with task scheduler it should accomplish what you need to do. If it doesn't just modify the source code. Since you know Java it should be easy!
http://www.gotdotnet.com/Community/U...0-af94143156ce Quote:
__________________
ChapterGrabber - add names to your chapters | BlogSvc - open source AtomPub server |
|
|
|
|
|
|
#4 | Link |
|
clueless n00b
![]() Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,256
|
@tactX: I also tries with .cmd ending and that didn't work either
![]() All required files are in the path so that can't be the problem either. Also, depending on the integer you set after the soon command the task is being added for today or tomorrow. For instance, if I set the delay to 15 the task is set for tomorrow (15 secs would just give me enough time to delete some files in temp2 so that I can see if robocopy is really doing something), if I use a delay of 300 the task is set for today but to wait 5 minutes to see if something is going to change is really annoying. Also, when I do it with 5 minutes, after 5 minues there's a new task scheduled for tomorrow at the time the task was supposed to run today, and it's marked as having an error ![]() @Emp3r0r: thanks, but I'm looking for something that doesn't require the .net runtime environment. I'm still really sceptical about .net. soon and robocopy are two exe files and would be all that is required to get the job done, it's just that they behave like *nix cli tools (meaning really erratic).
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
|
|
|
|
#5 | Link |
|
Registered User
Join Date: Dec 2002
Location: Netherlands
Posts: 8
|
Hi Doom ...
I once had the same prob as you and i had an easy solution (alltho it is not 100% the same as you wish to do it. Norton has in their dos toolkit a little nifty tool that is called wait.exe or wait.com You cann call this with a parameter <seconds> so 'wait 300' waits 5 minutes and then the tool exits. If you create a batch like this : 8<------------------------------------------- @Echo off :Loopdeeloop Robocopy c:\myfart d:\smellsbad wait 300 goto Loopdeeloop 8<-------------------------------------------- It's a simple tho powerful solution , if you want it to run at approximately every 5 minutes ( if the copyjob takes 2 to 4 minutes simply decrease the wait counter.. You don't have to schedule anything, simply a shortcut to this batchfile in your startup folder oughta do it.. good luck with it .. If you can't find wait.exe i'll see if i can find it somewhere ...
|
|
|
|
|
|
#6 | Link |
|
Registered User
Join Date: Dec 2001
Location: Holland
Posts: 13
|
Maybe this works?
soon 300 "%0"
robocopy c:\test1 c:\test2 /secfix /mir The soon 300 command schedules the job to run in 300 seconds. The %0 reschedules the soon command to run again. I found this with google, so I dunno if this works ;-) |
|
|
|
|
|
#7 | Link |
|
Registered User
Join Date: Dec 2001
Posts: 18
|
taskzip
Hi Doom9,
another option that would probably do what you want is a program I use to backup all of my important directories every day: a nice little freebie called Taskzip. http://www.pb-sys.com/ It defaults to creating zipfiles, but you can get it to simply copy the files too without zipping them- which sounds like what you want. I have it set to create sequentially named zipfiles. Every day it deletes the oldest, renumbers them, and adds the latest one. (workbackup1.zip, workbackup2.zip, --> workbackup5.zip being the oldest) You can specify however many backups you want to keep around. This program has saved my butt more than a few times. It's useful for network backups too. |
|
|
|
|
|
#9 | Link |
|
Registered User
Join Date: Dec 2002
Location: Vatican City
Posts: 16
|
Perhaps I might be sticking my head in where it doesn't belong, but I might suggest using a free program called Log Monitor
It allows for flexible scheduling and allows you to create custom rules for it to work with. I showed it to a friend of mine who is an administrator for an internet radio station and he found it useful because he could drop a music file into a folder and Log Monitor would detect it, automatically replicate it to the various servers and update each server's data base so that each server knew the new song existed. It was able to take care of some rather complex operations that he was unsuccessfully trying to do with a batch file and saved him lots of time. A big plus is that it can be run as a service in the background. I have no idea if this can help you at all, but I would recommend at least taking a look at it. B.R. FishB8
__________________
Rock is dead! Long live paper and scissors. |
|
|
|
|
|
#10 | Link |
|
Registered User
Join Date: Aug 2002
Posts: 123
|
::You using linux??
:: well i just read your post again after posting ...the START /W will wait for a command to finish before carrying on. However it should do that anyhow. Unless...well i never ran that program to comment more on that.::Im sorry but i have never used either program ever...however if you are trying to do a 5 min delay you could do this. This works on 2k/xp...on nt4/9x you could do a choice.com timeout. Actually the ping trick's work on any win system however you have to create a counter and i think if i remember that is not the easiest...easier to just find a script. However you could do dirty counter with 1's, 2's, 3's set foo=%foo%1 etc.. ::Below only works on 2k/xp due to the SET /A ::Ping is ~2 seconds -n determines the number of echos...2 echos is about 1.7 seconds...anyways im not sure if the win98's ping supports -n..if it does this is real easy. ::Also ping supports the -w XXX which means wait for XXX amount of milliseconds between each reply. However i think you need to have a valid(real) IP for that. Anyhow the -n does the same think just in longer intervals. ::This does work on 2k/xp and probably nt4 @echo off :_start robocopy c:\test1 c:\test2 /secfix /mir PING -n 310 127.0.0.1>nul GOTO _start ::i take that back now i do remember using soon.exe..only after learning serveral ways of doing internal scripts to do the same thing. Advantage of using one of these here or somethign other is that it does not require you to have a non-deployment file. ::Im sorry...again i dont know exactly what your trying to do. Choice and the ../t:Xnn works on nt4/9x i believe. ping works on all of them...below is NT4 WAY to use choice and get the same effect. :: CHOICE does NOT work on 2k/xp...no longer comes with it. SET /P is it's closest replacement.(which is better to me but has not timeout that i know of) ::IF 98 does not support ping -n (number of echos) then this choice example would work. ::choice can do upto 99 seconds...this will delay for 4:57min's @echo off :: :_start robocopy c:\test1 c:\test2 /secfix /mir CHOICE /C:N /N /T:N,99 CHOICE /C:N /N /T:N,99 CHOICE /C:N /N /T:N,99 GOTO _start :: optionally if you dont want to see anything you could do a call, null...like below. The advantage to this is that you dont have to >nul out every command with output. Also some commands like the choice.com do NOT like if you >nul at the end of their very special command :P. Also when scripts get larger it save's bytes. @echo off :: IF "%var%"=="1" GOTO _startx SET var=1 CALL backup.bat>nul GOTO _EOF :_startx set var= :_start robocopy c:\test1 c:\test2 /secfix /mir CHOICE /C:N /N /T:N,99 CHOICE /C:N /N /T:N,99 CHOICE /C:N /N /T:N,99 GOTO _start :_EOF ::again on linux there is a million and a half tools that can do this...but in win these are to me the less complexed and simplest... there is many ways to accomplish this same effect with FOR "delims=", TIME/T then FOR. FC.EXE, and several others i know of. Believe it or not the PING delay seems to use less resource's...no clue why though. Seem's it should use more. Last edited by \AX; 30th January 2003 at 04:56. |
|
|
|
|
|
#11 | Link |
|
Moderator
![]() Join Date: Oct 2001
Location: Germany
Posts: 2,660
|
Hello Doom9,
I guess this might help you: http://support.microsoft.com/default...;en-us;q237840 Sincerely bb |
|
|
|
|
|
#12 | Link |
|
Registered User
Join Date: Dec 2001
Posts: 11
|
If it doesn't have to be robocopy / soon.exe then Second Copy 2000 is a very nice alternative.
http://www.centered.com/products.html |
|
|
|
|
|
#13 | Link |
|
Registered User
Join Date: May 2002
Posts: 2
|
i've had similar problems with soon and at commands what I found was that u had enter the time in the last 30 seconds of a minute for it to work. this is because of rounding etc that the stupid scheduler does. i've modified a batch file from experts-echange to take any amount of seconds or minutes and the wait for that time or if u want use the top half of the code to make a time that u can pass to the at command directly (instead of using soon as u may have better luck)
Heres the batch files i've modified for u that i saw on experts exchange: Code:
@echo off
REM To use with at command dont set delays under 60 seconds
REM as M$ is stupid and sometimes set the task for tomorrow
REM ** Delay is set to 1 minutes
set delay_min=0
set delay_sec=300
REM set testtime=%time%
FOR /F "tokens=4 delims== " %%i IN ('NOW') DO SET testtime=%%i
if "%testtime:~0,1%"==" " set testtime=0%testtime:~1%
rem echo Time Now: %testtime:~0,8%
set /A hh=1%testtime:~0,2% - 100
set /A mm=1%testtime:~3,2% + %delay_min% - 100
set /A ss=1%testtime:~6,2% + %delay_sec% - 100
:SECONDS
if /I not %ss% GEQ 60 goto MINUTES
set /A mm=(mm+(ss/60))
set /A ss=ss%%60
:MINUTES
if /I not %mm% GEQ 60 goto NORMALIZE
set /A hh=(hh+(mm/60))%%24
set /A mm=mm%%60
:NORMALIZE
if /I %hh% LSS 10 set hh=0%hh%
if /I %mm% LSS 10 set mm=0%mm%
if /I %ss% LSS 10 set ss=0%ss%
rem echo Scheduled Time: %hh%:%mm%:%ss%
at %hh%:%mm%:%ss% /interactive cmd /c c:\backup.bat
rem at
rem pause
Code:
@echo off
REM ** Delay is set to 60 seconds
set delay_min=0
set delay_sec=60
REM set testtime=%time%
FOR /F "tokens=4 delims== " %%i IN ('NOW') DO SET testtime=%%i
if "%testtime:~0,1%"==" " set testtime=0%testtime:~1%
echo Start time: %testtime:~0,8%
set /A hh=1%testtime:~0,2% - 100
set /A mm=1%testtime:~3,2% + %delay_min% - 100
set /A ss=1%testtime:~6,2% + %delay_sec% - 100
:SECONDS
if /I not %ss% GEQ 60 goto MINUTES
set /A mm=(mm+(ss/60))
set /A ss=ss%%60
:MINUTES
if /I not %mm% GEQ 60 goto NORMALIZE
set /A hh=(hh+(mm/60))%%24
set /A mm=mm%%60
:NORMALIZE
if /I %hh% LSS 10 set hh=0%hh%
if /I %mm% LSS 10 set mm=0%mm%
if /I %ss% LSS 10 set ss=0%ss%
echo Waiting for: %hh%:%mm%:%ss%
:TIMETEST
REM set testtime=%time%
FOR /F "tokens=4 delims== " %%i IN ('NOW') DO SET testtime=%%i
if "%testtime:~0,1%"==" " set testtime=0%testtime:~1%
if not %testtime:~0,2%==%hh% goto TIMETEST
if not %testtime:~3,2%==%mm% goto TIMETEST
:SECTEST
if /I 1%time:~6,2% LSS 1%ss% goto SECTEST
echo %delay_min% minute(s) and %delay_sec% second(s) has gone by
REM set testtime=%time%
FOR /F "tokens=4 delims== " %%i IN ('NOW') DO SET testtime=%%i
if "%testtime:~0,1%"==" " set testtime=0%testtime:~1%
echo End time: %testtime%
set testtime=
set delay_min=
set delay_sec=
set hh=
set mm=
set ss=
also to see why u have an error try running in interactive mode to see what is going wrong. Last edited by z3r3; 31st January 2003 at 08:28. |
|
|
|
|
|
#14 | Link |
|
Registered User
Join Date: Nov 2002
Posts: 49
|
Use http://search.winnetmag.com/ and put soon in the search box. Lots of good articles on this.
__________________
Thanks. |
|
|
|
|
|
#15 | Link |
|
Forum Administrator
![]() Join Date: Oct 2001
Posts: 189
|
' Mark Saunders ' asked me to post this:
Hi, I haven't been registered on the board long enuff to reply so I hope this answer gets to you. Are you using NT4? If so, I know the problem well. NT4 originally came with the task scheduler run by atsvc.exe. A version of IE upgraded this to mstask.exe at some stage. Mstask.exe for NT4 is broken. The simple answer for you to get soon.exe working if you are using NT4 is to stop the task scheduler service and mod it (regedit the service key) so it runs atsvc.exe again. Hope this is of some help. |
|
|
|
|
|
#16 | Link |
|
clueless n00b
![]() Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,256
|
@DaveEL: I've already tried that without success.
@bb, kaizen: I'm using xp but I'll try it anyway.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
|
|
|
|
#17 | Link |
|
Registered User
Join Date: Aug 2002
Posts: 123
|
??
So what is your problem??? All the above script examples and links to help seem valid and should clear this up. What EXACTLY are you trying to do??
With all the above script examples you dont need soon.exe IF your just trying to create a 5min delay. Sorry i just dont know exactly what you are trying to do and what is holding you back. This thread seems to be giving you everything you need to accomplish the problem you have presented. BTW z3r3: Your script will work just fine..only thing i wanted to give you a heads up on was the %time% variable is not always set on ALL systems..or it gets reset. You should use the command to get the time variable. Something like this FOR /F "tokens=1,2,3,4 delims=PAMpam" %%i IN ('TIME/T') DO SET TIMEX=%%i%%j%%l%%m you will have to edit it to whatever you got on your system but that way is a sure shot regardless of the %time% being set already to anything. Also something im just ficky about...i use the :: instead of REM as a comment :: is 1 less byte :-)...im just ficky that way. All in all that is a nice approach. Last edited by \AX; 31st January 2003 at 02:09. |
|
|
|
|
|
#18 | Link |
|
Registered User
Join Date: May 2002
Posts: 2
|
since u r using winxp have thought of using 'schtasks.exe' ('schtasks.exe' replaces 'at' command on winxp) to schedule a task that runs every minute or every 2 minutes or whatever ur need may be.
this way u dont need to run soon but the thing is u may have overlapping tasks doing this if the copy takes 5 minutes and u schedule it to occur every 1 minute!! |
|
|
|
|
|
#19 | Link |
|
clueless n00b
![]() Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,256
|
@ \AX : I didn't claim the tips above didn't work except when I said something to a specific tip by a specific person. I honestly haven't had time to test it all out (it's for my day job and I don't feel like working in the evening so it had to wait till the next possible opportunity - which is now).
I'm trying (now successfully thanks to z3r3's tip) to mirror two directories on two different HDs in a computer at work, and this in a regular interval. Now that I have it working properly on my local computer it's time to try it on the remote machine.
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
|
|
|
|
#20 | Link |
|
clueless n00b
![]() Join Date: Oct 2001
Location: somewhere over the rainbow
Posts: 10,256
|
@everyone: thanks for your tips, my problem is now solved. schtasks, unlike soon/at always works as advertised so my backup problems are now solved
__________________
For the web's most comprehensive collection of DVD backup guides go to www.doom9.org |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|