Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Close CD/DVD tray via the command line System
My G4 is hidden under my desk and I don't know why, but my CD/DVD burner tray is always open, letting the dust damage the delicate mechanism. I searched and found what I want in the command drutil. Use this in your favorite crontab:
# autoclose of dazed tray user
*/5 * * * * youruserhere /usr/bin/drutil tray close -drive internal
Simple but useful. Love UNIX. If you want to affinate this command for your use, don't forget the man drutil command -- it is a rich utility. PS: Tested with Toast 6.0, this hint seems harmless when you burn or erase medias.

[robg adds: I'm not sure if this one is 10.3-only or not...]
    •    
  • Currently 3.00 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (2 votes cast)
 
[12,203 views]  

Close CD/DVD tray via the command line | 10 comments | Create New Account
Click here to return to the 'Close CD/DVD tray via the command line' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Close CD/DVD tray via the command line
Authored by: ynolo on Nov 03, '03 01:08:46AM

I tried this with Mac OS X before panther and it does not work. the drutil is not installed except in panther.


---
i don\'t have one



[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: macubergeek on Nov 03, '03 05:46:32AM

yeh I think its new with Panther. My jag iMac dosn't have this util



[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: FunkDaddy on Nov 03, '03 09:02:25AM

I also find if you push the front of your drive it closes too! ;)



[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: ulrich on Nov 03, '03 12:04:07PM

You can also press the "open/close" key on the keyboard in the top right corner ;-)



[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: Pi_ on Nov 03, '03 02:39:52PM

For some reason, whenever I boot up, the CD tray opens. I've got jaguar, though, so I can't tell how helpful this hint is :P



[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: weileong on Mar 28, '04 03:01:49AM

it might have something to do with your USB devices. It's happened to me before with certain brands of mice. If you hold down a mouse button while booting, the tray ejects - I'm figuring the USB device's intialisation process, depending on how it's done/handled, even without the button being held down it may be telling the system that it *is*, hence the tray eject on boot. maybe try unplugging your USB devices one by one until you find out which one causes it?



[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: Accura on Nov 03, '03 05:30:36PM

If you leave your cd tray open for a while jag (not sure about panther as i have only been running for a day... lovin it already) it closes.. not sure on the timing but some times i hear my cd drive close.. weird. I'm not 100% sure on this and don't care enough to test it

jameso

---
"The time has come," the walrus said. "To talk of many things..."



[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: gmackenz on Nov 03, '03 10:42:31PM

drutil only works with burners...So tip no good for ejecting from internal CD-ROM my audio CD from the command line.



[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: bonatoc on Mar 06, '04 04:24:47PM
...mmh... not true, it works with my internal CD drive on a Dual G4 1,25. Just wrote a quick Applescript (and made it an app) to make sure my tray is closed. In case some wonder what is this useful for, some professional audio studios have all their machines in a separate rooms. Sometimes you go and manipulate some CDs, come back to the desk, work a little, and then forget if the tray is open or closed. As the icon displayed on the screen is the same, there is no way ti know if you're opening or closing the tray... Just copy-paste in AppleScript, and then Save as an App.

do shell script ("drutil tray close")
do shell script ("drutil tray close")

display dialog "Your CD tray is now closed." with icon 1


[ Reply to This | # ]
Close CD/DVD tray via the command line
Authored by: bonatoc on Mar 06, '04 04:26:27PM
...mmh... not true, it works with my internal CD drive on a Dual G4 1,25. Just wrote a quick Applescript (and made it an app) to make sure my tray is closed. In case some wonder what is this useful for, some professional audio studios have all their machines in a separate rooms. Sometimes you go and manipulate some CDs, come back to the desk, work a little, and then forget if the tray is open or closed. As the icon displayed on the screen is the same, there is no way ti know if you're opening or closing the tray... Just copy-paste in AppleScript, and then Save as an App.

do shell script ("drutil tray close")
do shell script ("drutil tray close")

display dialog "Your CD tray is now closed." with icon 1


[ Reply to This | # ]