|
|||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
#1 |
|
All Star
Join Date: Jan 2004
Location: Limerick, PA
Posts: 687
|
Want a means to gracefully quit iTunes running in another user's account
Background:
My family all shares a single iTunes library, located in a shared folder. This has worked well for years, but has one mild annoyance. Only one user can be running iTunes at a time, since the library is locked when in use. Sometimes another user wants to run iTunes, but first needs to log-in as another user to quit their running iTunes, then switch back to their account to launch it again. With kids in the house, this is not optimal, as we don't want them having the login passwords of the adults. I've tried using force quit, and the UNIX kill command to stop iTunes running when it is in use by another user, but neither of these has been desirable, because they don't get Tunes to quit gracefully (like using the Quit menu item does). For example, sending "killall -v -TERM -c 'iTunes' " causes a instantaneous quit, and the next time iTunes is launched, it has to rebuild it's library. The Question: I'm looking for a UNIX command that can tell iTunes to Quit gracefully. Once I have that, I can throw together a shell script that User X can run that will close iTunes in User Y's account. Last edited by cpragman; 10-06-2012 at 11:14 AM. |
|
|
|
|
|
#2 |
|
Hall of Famer
Join Date: Dec 2007
Posts: 3,642
|
I have no help to offer with the solution you're proposing, but I'm wondering if enabling Sharing in the iTunes Preferences of each account would work as an alternative.
|
|
|
|
|
|
#3 |
|
Hall of Famer
Join Date: Jan 2002
Posts: 2,934
|
I think the media should be on a shared volume, but each account should have its own library. You'll have to start each iTunes account with a blank library. Then drag the shared media folder onto the iTunes window while holding down the option key. That'll tell iTunes to use that media without copying it.
|
|
|
|
|
|
#4 |
|
League Commissioner
Join Date: Sep 2003
Location: Tokyo
Posts: 6,050
|
sudo -u otherusername osascript -e 'tell application "iTunes" to quit'
Sharing sounds like a cleaner option. |
|
|
|
|
|
#5 | |||||||||||||||||||||||
|
MVP
Join Date: Apr 2008
Location: Berkeley CA USA
Posts: 1,010
|
That would require letting the kids know an admin password. |
|||||||||||||||||||||||
|
|
|
|
|
#6 |
|
League Commissioner
Join Date: Sep 2003
Location: Tokyo
Posts: 6,050
|
Ah, you want the one-click child-and-management-proof option?
Write a stone-simple C program that runs the above command for all regular users (minus `sudo`). Compile, test, set the suid bit and change the owner to root. Now write an Applescript to simply call it with `do shell script`, followed by `open iTunes.app`. |
|
|
|
|
|
#7 |
|
All Star
Join Date: Jan 2004
Location: Limerick, PA
Posts: 687
|
Does it have to be a C program, or can a shell script also run with setuid?
|
|
|
|
|
|
#8 |
|
MVP
Join Date: Apr 2008
Location: Berkeley CA USA
Posts: 1,010
|
No. suid is ignored on shell scripts. (It would be too easy to invade a system otherwise.)
|
|
|
|
|
|
#9 |
|
League Commissioner
Join Date: Sep 2003
Location: Tokyo
Posts: 6,050
|
We're not talking a complex XCode project here:
Code:
#include <stdlib.h>
int main (int argc, char *argv[])
{
system("your shell command here");
return 0;
}
|
|
|
|
|
|
#10 | |||||||||||||||||||
|
All Star
Join Date: Jan 2004
Location: Limerick, PA
Posts: 687
|
Perhaps something like this? Figuring out the escaping of all the quotes took a few tries.
|
|||||||||||||||||||
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|