My Main application takes time to launch due to a non correctable bug in the framework i have used.I have created a launcher program that simply displays a loading animation and does the background work(one time) and after doing that the main app loads.
I dont have any success in creating an installer package that executes a post installer script.Is there a way i can check if the loader was executed once using a shell script.In the first launch i plan to create a dummy file and in subsequent launches the script check if this file is there.If its there the main program will be launched instead of the launcher.
Not sure, how and what your loader is. However, in your loader or the script that launches the loader, try writing the PID for the loader when it runs :
echo $! > run.pid
To check if your loader has run/executed first time, in your shell script, just check if the run.pid file exists :
if [ -f run.pid ]
then
launch the main program
else
// do something
fi
Hope this helps
Related
Is it possible for a batch program and shell script to know if a previous instance of itself is still running and wait until that program ends before triggering the next step in the command line?
We have a bat file and a corresponding shell that is triggered by an application which writes logs into a file, what happens when multiple users use the same application and triggers the program at the same time is that the logs get jumbled and is not readable by the program that turns the log into a PDF.
Thanks.
I have a legacy VBS script that runs on a schedule via task scheduler. The script checks a folder (located in a mapped network drive) and processes the files it finds in the folder.
Recently it just stopped working. I didn't write this script, I've only inherited it. It no longer seems to find files in the folder it's looking in, even when they're there. To test we created a log file and wrote file names to it. When manually double-clicking the file and running it from explorer it writes to the log file and sees everything in the directory. If you run it from the Task Scheduler it sees no files and writes nothing to the log file. It also runs for days and never seems to exit when the scheduler runs it, even if there are no files and when I run manually it closes immediately when there are no files.
We have several other legacy scripts that are very similar in function to this one and they all work exactly as expected without issue.
This script is run as administrator (the others are as well). I set the "Start In" to it's current directory (the start in directive is not set for the other scripts and they function normally) and this did not help.
This script uses full file paths to everything (the others do as well).
It works as expected only when double clicked.
In order to extract data from a website, I would like to open a program that does just this and open a URL inside (!) the running application. I would like to execute this as a shell script.
echo "Launching Program"
#if ["$1" -eq "0"]; then
# Application exited successfully. Restarting.
/Users/Path/to/app/Contents/MacOS/app
open http://www.example.com
#else
# An error occured. Do nothing and exit.
# exit
#fi
This is what I got so far, but this starts the application and opens the URL in a separate browser window. I would like to open the URL inside of the application and also perform other actions with the retrieved data later on. What would be the best way to do that?
How can I "interact" and perform actions inside a running application from the command line on Mac OS?
Any hints would be appreciated.
You can tell open to use something other than the default application for the file to be opened:
open -a /Users/Path/to/app http://www.example.com
Interacting with the program requires that the application be scriptable (generally with AppleScript, but possibly some other scripting language), or more painfully (if the application itself isn't scriptable) using AppleScript to simulate using the GUI of the application.
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.
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