Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

mavis

macrumors 601
Original poster
Jul 30, 2007
4,771
1,541
Tokyo, Japan
Hey guys,

I'm sorry to post such a stupid question, but I'm really lost here - this is my first Mac and it's only a few days old, so I have no idea what I'm doing. I've tried Googling this but the results are way over my head ... :(

Basically I have two Terminal commands that I'd like to run every time I login. The commands are:

cd /Applications/WizD/
sudo ./wizd

Of course I'd like my password entered automatically as well - I would just like this to happen as quickly as possible, in the background, every time I login. I've been told I can do this with a script, but I don't even know where to begin. Any ideas? For example, if my password is 12345, how would I put this whole thing into a script and have it run every time I login?

If anyone has any idea how to do this, I'd really appreciate your help!
 

mavis

macrumors 601
Original poster
Jul 30, 2007
4,771
1,541
Tokyo, Japan
No, it is.

What is wizd? Why are you launching it with root privs?
It's a media server for my Avel LinkPlayer 2, apparently the only way to get it to run is to give it superuser privileges ... I ran it for a couple of years on my Windows box, I set it up to run as a service so it was totally transparent - every time I booted up, it ran automatically in the background. I'd like to do something similar with this iMac if possible - I just want to have it running all the time (because there's nothing more annoying than sitting down for dinner, turning on on the TV, and getting a "Server cannot be found" message when all I want to do is watch some Simpsons or Smallville or something) ... ;)

Any help would be greatly appreciated!
 

SC68Cal

macrumors 68000
Feb 23, 2006
1,642
0
You could give it a SUID bit, so you don't have to invoke sudo all the time.

If you trust the app...... SUID bits aren't just given out like popsicles. I'd reccomend updating to the latest version to ensure you're secure.

Code:
sudo chown root wizrd
sudo chmod 4755 wizrd
 

mavis

macrumors 601
Original poster
Jul 30, 2007
4,771
1,541
Tokyo, Japan
You could give it a SUID bit, so you don't have to invoke sudo all the time.

If you trust the app...... SUID bits aren't just given out like popsicles. I'd reccomend updating to the latest version to ensure you're secure.

Code:
sudo chown root wizrd
sudo chmod 4755 wizrd

Thanks you for the reply. I tried doing this but it didn't work - when I logged back in I was unable to launch WizD until I did the original commands (in the first post here) ...

I guess what I need is a way to enter these terminal commands:

Code:
cd /Applications/WizD/
[press enter]
sudo ./wizd
[press enter]
12345 (whatever my password is)
[press enter]
[quit terminal]

Is anything like this possible? Thanks again for you r help, I appreciate it :)
 

SC68Cal

macrumors 68000
Feb 23, 2006
1,642
0
You must not be doing it correctly. The whole point of a SUID bit is so that you don't have to invoke sudo to get it to run at the root level.
 

mavis

macrumors 601
Original poster
Jul 30, 2007
4,771
1,541
Tokyo, Japan
You must not be doing it correctly. The whole point of a SUID bit is so that you don't have to invoke sudo to get it to run at the root level.

Wow, you're right - I must've messed something up because I just tried it again and this time it worked perfectly. :D

Thanks so much for your help!!!! This was the last Windows app I really wanted to have running smoothly on the Mac, and now it's done! Thank you!

One little question, though - now that I've added wizd to my login items, it leaves a Terminal window open when it loads. Not a huge deal, but is there any way to get it automatically quit Terminal once it has loaded?
 

Mernak

macrumors 6502
Apr 9, 2006
435
16
Kirkland, WA
my bad, I read it as /.wizd and was wondering why an application would be hidden so I figured he was using a shell script instead of Finder. So, I would agree with checking the "Hide" box (but that would still annoy me)
 

todd2000

macrumors 68000
Nov 14, 2005
1,626
11
Danville, VA
my bad, I read it as /.wizd and was wondering why an application would be hidden so I figured he was using a shell script instead of Finder. So, I would agree with checking the "Hide" box (but that would still annoy me)

Why would that annoy you? Click the box one time, and forget about it.
 

jbstew32

macrumors regular
Jan 15, 2007
146
1
this is really only 1 command: sudo /Applications/WizD/wizd

The only question is 'how do I run this upong login with root permissions?'

here's a link that should help: http://docs.info.apple.com/article.html?artnum=301446

That explains how to run a shell script at login, but I have never tried it. If it gives you trouble because wizd is an application and not a script, then just make a simple bash script that starts the application.

ie


#!/bin/bash
/Applications/WizD/wizd &
exit 0



or something along those lines...
 

mavis

macrumors 601
Original poster
Jul 30, 2007
4,771
1,541
Tokyo, Japan
Why would that annoy you? Click the box one time, and forget about it.

Actually, clicking the box didn't do the trick - Terminal still pops up whenever I log in. It's really not the end of the world though, and if OSX is as stable as everyone seems to think, I guess I probably won't be re-booting often enough for it to be an annoyance. ;)

Anyway I want to thank everyone for the great advice here - I've got it set up and working and I really appreciate the help!! :D
 

mavis

macrumors 601
Original poster
Jul 30, 2007
4,771
1,541
Tokyo, Japan
You could give it a SUID bit, so you don't have to invoke sudo all the time.

If you trust the app...... SUID bits aren't just given out like popsicles. I'd reccomend updating to the latest version to ensure you're secure.

Code:
sudo chown root wizrd
sudo chmod 4755 wizrd


I'm sorry to resurrect such an old thread, but I'm still having problems with this :(

Following the instructions here, I got things to work perfectly, for about a week, but ever since then I've had to go about this the way I posted above (first post in this thread) to get WizD to work. Does anyone here have any ideas about how I can get this stupid server to launch automatically when I turn on my Mac?

Any help would be GREATLY appreciated!
 

mavis

macrumors 601
Original poster
Jul 30, 2007
4,771
1,541
Tokyo, Japan
Wirelessly posted (iTouch 1.1.2 (JB'd): Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3)

Hmm ...

So is what I'm trying to do simply not possible on a Mac?
 

sreedy

macrumors 6502a
Feb 24, 2005
501
0
Somerset
Wirelessly posted (iTouch 1.1.2 (JB'd): Mozilla/5.0 (iPod; U; CPU like Mac OS X; en) AppleWebKit/420.1 (KHTML, like Gecko) Version/3.0 Mobile/3B48b Safari/419.3)

Hmm ...

So is what I'm trying to do simply not possible on a Mac?

Check the ownership\permissions haven't been changed back by something:

ls -ltr ~/Applications/WizD/wizd
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.