‏إظهار الرسائل ذات التسميات process. إظهار كافة الرسائل
‏إظهار الرسائل ذات التسميات process. إظهار كافة الرسائل

الأحد، 5 يناير 2014

Check the Errorlevel value and process the if command

The "problem" with your code is that when the parser reach that line, the %errorlevel% variable is replaced with its value, and then the line is executed. So, any change to the value of the variable is not seen. The "usual" way of handling this cases is enabling delayed expansion and change the %errorlevel% sintax with !errorlevel! to indicate the parser that the value will change and need to be retrieved at execution time.

But, in this case, as you have the requirement of a "one liner", change the if test to

if errorlevel 1 (echo "SQL Not Installed") else (echo "SQL Installed")

A standard construct to check for errorlevel without reading the variable value.

You have also the posibility to code it as

reg query .... && echo Installed || echo Not Installed

This executes the reg command (with all your parameters, of course). On success, the command after && is executed. On failure the command after || is executed.


View the original article here

الثلاثاء، 24 ديسمبر 2013

nohup vs screen -- which is better for long running process?

Background: I have a long running script that makes database schema changes that has output I would want to check after the migration. I would want to write this to a file.

I have been reading stack overflow about nohup and screen. I have tried both and have concerns about both.

IN: How to run process as background and never die?

They said they used nohup and putty killed the process. How is this possible? I have been unable to replicate using Mac OS X terminal.

With screen I am terrified of typing exit instead of ctrl + a, d

Also If I just quit the terminal app when using screen, it seems to preserve the state.

Screen seems to be the better solution because it is really nifty how you can have a bunch of them open and switch back to the state.

What would you recommend in my situation? I don't have the run the script for another month or so (When I have a release). Should I become more comfortable with screen and just stick with that?


View the original article here