XCode build phases: run script in background (without blocking build) - xcode

I'd like to be able to run a script in the background (i.e. without blocking the build process) when I build and run an iOS application in the simulator. I've tried osascript /path/to/script &, and also backgrounding a separate shell script that does the same, but neither have worked; the build stops and I have to force quit XCode.
Any ideas?

I had the same trouble with running a background script as part of the build phase but the following does work in my case. The script runs in the background while my app runs. Apparently, you have to redirect the standard output in addition to using the "&". Use the following format. (My script is located in directory '~/Desktop/splint_server/')
~/Desktop/splint_server/run.sh > ~/Desktop/splint_server/test 2>&1 &
This runs an arbitrary script at ~/Desktop/splint_server/run.sh (put the path to your script there). The output is redirected to a log file called "test".
More information about I/O redirection http://www.tldp.org/LDP/abs/html/io-redirection.html

Incase you are still interested.
These are the steps you need to follow:
1. Change the .sh extension of your script to .command
2. Rather than invoking /path/to/script.sh you now start using "open /path/to/script.command"
Thats pretty much it.
This will start a new terminal window and run the script you want in it.

You could use post-actions of build in the schemes setting.
"sleep 100&" works fine

Related

Powershell Script converted to EXE via Win-PS2EXE can be run manually but errors out when run as a scheduled task

The application moves files from one directory to another, runs an exe, and then moves files from one directory to another.
When I run the application manually it works as expected.
However, when trying to run it as a scheduled task I get the following error: 3762504530
I did some researching and it appears it may have to do with the application trying to run interactively even when there is no user actually logged in.
I have tried to suppress outputs but that didn't seem to have any effect.
Without seeing the code i guess u use console output or similar...
If so change write-host to write-output or alias "echo" pipe it to log file if u want...
Also be sure that your script run "non interactive" (no prompts etc.)
Unchecking compile a graphic windows program (parameter -noConsole), remedied the error.

run DXL script on the background (command line) : DXL/DOORS

I am trying to start a dxl script with command line. But i am getting lots of warnings and errors.
When I try this script on doors gui , it works fine but when i try on this command line without gui, it doesn't.
Here is the image of warnings :
Here is the commandline script :
"%ProgramFiles%\IBM\Rational\DOORS\9.3\bin\doors.exe" -d 36677#bie -u "xxx yyy" -P don -b "d:\workset\mc\addins\Devel\exporterRTF.dxl"
Why it doesn't work with commandline ? Any help, idea etc is appreciated.
EDIT :
this is a link which i try to run : myprogram.dxl
this is a link which is imported in my running script include in myprogram.dxl
this is a link which is secondly imported in my running script include in myprogram.dxl
There are other settings you need to run in Batch mode (pulled from the DOORS help):
Runs Rational DOORS in batch mode. Rational DOORS starts without the GUI (it suppresses the login screen and the database explorer), runs the specified DXL program, and then stops.
In batch mode you normally need other switches like -user, -password and -project to log in and specify the current project.
The parameter of the -batch switch specifies the file that contains the DXL program that you want to run in batch mode.
You probably need a current project specified. Also you may need to add a command at the end of your script to exit DOORS if you don't want the session to stay open.
The errors that you list seem like regular DXL errors, so if you need more assistance than this, you will need to post some of the code.
EDIT:
If you put all of the files into one does it run? Another option may be to include the Addins path on your command line. I believe the issue is that the batch mode is not recognizing the included files as part of the same scope.

How can I run a shell script on only the next startup? Is it possible to set this up from within a script?

I am trying to make a script to run Once on next startup in OSX Lion. The script is very simple, I am just recording the time of the boot and comparing it to a previous know time. What I would really like to do though is to not have to manually add a startup item, since this will be set up on a very large number of computers.
Is there a way to add a startup item from a script to only run once?
Say your script is called script.sh... Place the script in the directory /System/Library/StartupItems/
Then, just simple add the command rm -f /System/Library/StartupItems/script.sh to the end of your script.

Automator Application to Tar File

I have tried creating an application in Automator that when double clicked, will tar my To-Do.txt file. The command I'm using is pretty standard:
tar -cvzf ToDo.tar.gz /Users/myusername/Desktop/To-Do.txt
The above command works perfectly when entered into a terminal, so I created an application in Automator and put the 'Run Shell Script' action into the workflow with the command above. However, when I double click the application it does nothing at all.
If I run the workflow in automator, it runs successfully so I know there are no errors.
Can anyone tell me why this isn't working?
I have managed to get it to work by changing the 'Shell:' option to /bin/sh instead of /bin/bash.
Works really well. I also changed the specified filename to use arguments $# and can now Tar any file with it.

run windows command from bash with output to standard out?

Folks, I'm using git tools such as git bisect run which need to call a command to build and test my project. My command to do is nant which is a windows program. Or a build.cmd script which calls nant.
It's easy to get the bash to call the nant build to run.
But the hard part is how to get the standard output written to a file?
I even installed the Windows PowerShell to try running a command from bash.
Again, it works but the standard output fill says "permission denied" when
I try to read it while the build is going on.
Update:
When running nant, the entire path is used. It is installed and runs fine. The problem is how to get the standard output when running from bash.
If running nant from the windows prompt with "> build.out" at the end of the line, you will get the standard out. But the same never works under bash. It just says build.out is locked, permissions denied.
Update:
Using tee as suggested below also doesn't solve the problem. In that case the file still report "access is denied" with any attempts to read it while the build runs. But also, the tee program never writes anything to standard output.
(If I am understanding your question correctly...)
You can probably use the 'tee' command to split the output to both a file and stdout. The line echo I am building something | tee build.out will both print the output on the console and save it to the file named "build.out".
The tee command is usually available in Cygwin, and also apparently in the Bash shell installed by msysgit (where I just tested it). Here's a good reference page for more details.
Okay, finally resolved this. It turns out the the nant build script was using git feature to erase all ignored files to cleanup. That was deleting the build.out file can causing these strange issues. Now, the process writes the build.out file to a parent directory so that it won't get deleted and now everything works smoothly as expected.

Resources