Start a GUI app as a daemon?

michaelsanford

Translator, Web Developer
My application is that I'd ideally like to be able to start a program like Folding@Home without logging in.

That way I could still run the app, and check from my office (with who) if someone's logged in at my console.

Impossible?
 
If the application is a .app, then in the terminal go through the package contents to find the actual executable for the program, and then type:

Code:
./executable &

you can do this to happen at startup...

Try putting a file in the /Library/StartupItems directory with:

Code:
ConsoleMessage "Starting executable"
/path/to/executable &
 
Code:
[gwailo:/applications/folding@home.app/contents/macos]% ./Folding@home &
[1] 477
[gwailo:/applications/folding@home.app/contents/macos]% 2002-11-12 11:03:59.190 Folding@home[477] No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting

[1]    Exit 1                        ./Folding@home
[gwailo:/applications/folding@home.app/contents/macos]%

I also get this error with Address Book.

Thanks thought! What exactly does the "app_name_executable &" notation tell tcsh to do?
 
Appending a & to a command line causes that command to be run in the background, returning control of the terminal to the shell rather than suspending the shell until the command terminates.
 
Anarchie,

I think you are getting a little confused with the & notation.

What you have said is correct, it just makes the OS spawn another thread so the current terminal is free to continue.

This doesn't mean the program is running as a daemon and it won't live after you log-out.

(if anyone does know how to do this, that would be awesome)

-Dan
 
Originally posted by Grecy
Anarchie,

I think you are getting a little confused with the & notation.

What you have said is correct, it just makes the OS spawn another thread so the current terminal is free to continue.

This doesn't mean the program is running as a daemon and it won't live after you log-out.

(if anyone does know how to do this, that would be awesome)

-Dan

I know that the & alone doesn't cause the program to detach from the terminal. You have to redirect its standard input, output, and error to someplace other than the terminal to fully detach it. Usually, you'd put /dev/null on stdin, and some logfile on stdout/stderr:

./smaug < /dev/null >& smaug.log &
 
Back
Top