eject that is available by default in most of Linux distributions, allows to open and sometimes close removable media tray (usually it’s CD-ROM or DVD media).
To eject media:
As you see the name of device can be a device file or mount point, either a full path or with the leading “/dev”, “/media” or “/mnt” omitted. If no name is specified, the default name “cdrom” is used. With
-c option a CD slot can be selected from an ATAPI/IDE CD-ROM changer.
To close tray:
eject -t cdrom
Dear reader, I hope you know what use
eject command for if you came here, but let me suggest one more application. You can use this command to make your own cuckoo clock! 🙂
Just put little shell script opening and closing cdrom or dvd tray into cron…