View Full Version : Login Item to Start Command Line Service (VNC)
02-14-2004, 02:05 PM
All right. I've been messing around with OSXvnc, and I'd like to have it run as a login item, but not display it's icon in the dock. So, I figured out what command it was running by looking at it's log, and got the server running by simply typing in the command line.
Now, I want that command to be run every time I log in, but I don't like the System Service model since it disables copy and paste. I would simply use a .command file, but I would prefer that no terminal window pop up. And I tried using an Applescript, but it would open and then hang since the command never returns (it doesn't work when I try to background it with an &, either).
So, is there a more graceful way of executing command prompt commands at login?
02-14-2004, 05:48 PM
Using AppleScript will work if you add a little bit of output redirection to the end of the shell command. Apple has a technote about the do shell script addition here (http://developer.apple.com/technotes/tn2002/tn2065.html) that describes this process (among many other points), but basically you want to do something like this:
do shell script "/Applications/OSXvnc.app/OSXvnc-server -rfbport 5900 > /dev/null 2>&1 &"
This redirects any status or error messages from the VNC server into oblivion and sends the process into the background, allowing your AppleScript applet to quit instead of hanging. If you prefer to log the server's output, you can replace "/dev/null" with the path to a text file.
02-14-2004, 05:57 PM
Make a shell script, remembering to give full paths for commands and files. It will be easiest if you use a Unix text editor. For example, if you like pico, you can type:
sudo pico /Library/StartupItems/OSXvncStartUp
# This script will start OSXvnc at startup
command to launch OSXvnc
Save it with a properly descriptive name like OSXvncStartUp in /Library/StartupItems. If you use the command I've suggested above and are using pico, you just need to hit <Control-X> <Y> <Return>
Make it executable.
sudo chmod a+x /Library/StartupItems/OSXvncStartUp
Reboot to test.
02-14-2004, 06:37 PM
Wonderful Lankhmart. Just what I've been looking for. Thank you. :D
And, trevor, I was looking for a login item since if vnc is a system service it disables copy and paste for security reasons. Thanks though.
06-11-2009, 03:40 PM
So how do you set a default password?
vBulletin® v3.8.7, Copyright ©2000-2013, vBulletin Solutions, Inc.