1

Closed

Have to call script while in snapraid dir:

description

Hi,
Great script, got it to work by using the one here... the pastebin one was giving the stupidest errors.

So, if I run the script from a prompt outside the snapraid dir (even though ini has the snapraid directory), I get a snapraid.conf error, it can't find it.

No problem, I can run task scheduler to have current dir c:\snapraid (no trailing slash for task scheduler).

But, I'm surprised the conf file path doesn't get passed onto snapraid.exe when called?
Closed Mar 15, 2014 at 5:46 PM by therealjmc
Fixed

comments

therealjmc wrote Mar 14, 2014 at 9:22 AM

Hi,

That's because there snapraid conf file is not passed to snapraid as an argument - since there was no need for it in my case, I had the current dir set to the snapraid dir, too. I've changed the script and ini to include a setting for this, please give it a test and give some feedback if this solves the problem.

robnitro wrote Mar 14, 2014 at 9:06 PM

Nice, works well.
I see the change is one line for the conf file... so we can rename it or run different versions.

One other thing, for the pre and post process, how would I run my script? (I dont see quotes allowed, in case I wanted to add switches or run it as "cmd /c c:\snapraid\wdriveenable.cmd" etc.

I have a program called Hotswap!.exe (also renamed to hotswap.exe) which allows me to spin down and remove a drive from explorer.
hotswap.exe w: -q to take down drive
hotswap -S -q to bring up drive
I run them through a simple dos batch using ping to delay (sleep) 20 seconds for the drive to be detected, or before spinning down the drive.

therealjmc wrote Mar 15, 2014 at 10:10 AM

That's not so easy as far as I know - passing multiple arguments with one variable is kind of different. I'm running single exe files as pre/post scripts (compiled autoit scripts). I'll take a look into it. But could you try just setting the .cmd as pre/post process and see if that works?

robnitro wrote Mar 15, 2014 at 4:37 PM

Got it to work...
It was giving me an error exit level 1 of pre process, as before.
But this works, setting errorlevel 0 (as ping probably gives a code for failing and sleep doesn't really exist.
Much better than using task scheduler for the final disable, which doesn't always work, and the drive remains.

WdriveENABLE.cmd
c:\snapraid\hotswap!.exe -S -q

ping 123.45.67.89 -n 1 -w 20000

errorlevel 0

exit 0

WdriveDISABLE.cmd

ping 123.45.67.89 -n 1 -w 8000

c:\snapraid\hotswap!.exe w: -q

errorlevel 0

exit 0

wrote Mar 15, 2014 at 5:46 PM