回答:
sudoです。
eject私のために働いた後、次のエラーで動作を停止しました:「eject:/ dev / cdrom:指定された名前のマウントポイントまたはデバイスが見つかりません」。実行後、などをeject /dev/sr0再び使用することができますejecteject -T
コマンド:
ejecteject -talias opentray='eject'
ドライブを取り出すときにいくつかの問題が発生します。マウントされているなどの理由で、取り出したくない場合があります。これをオーバーライドするには、eject -l /media/mountpointor(/mnt/mountpoint)を使用します。opentrayコマンドラインに入力するだけで呼び出せる関数を作成しました。
これは次の場合にのみ機能します
/dev/sr0(に/dev/cdrom象徴的にリンクされている、と同じもの/dev/sr0)function opentray ()
{
mountdir="/media/DVD"
if [ -d "${mountdir}" ] # If directory ${mountdir} exists
then
if [ $(mount | grep -c "${mountdir}") = 1 ] # If drive is mounted, then
then
echo "/dev/sr0 is now mounted to ${mountdir}. I'll try to unmount it first and eject/open the tray."
umount -l "${mountdir}"
rm -r "${mountdir}"
sysctl -w dev.cdrom.autoclose=0 # Ensure drive doesn't auto pull tray back in.
eject
exit
else
echo "/dev/sr0 is not mounted. Opening the tray should be easy. Ejecting/opening now."
rm -r "${mountdir}"
sysctl -w dev.cdrom.autoclose=0 # Ensure drive doesn't auto pull tray back in.
eject
exit
fi
else
echo 'The directory "${mountdir}" does not exist. Ejecting/opening the tray.'
sysctl -w dev.cdrom.autoclose=0 # Ensure drive doesn't auto pull tray back in.
eject
exit
fi
}
完全を期すために、このエイリアスを.bashrc(または.bash_aliasesファイル)に追加して、コマンドラインからトレイを戻すことができます。ルートである必要はありません。
alias closetray='eject -t'
アプリケーション「ターミナル」で次のいずれかを入力します。
ejecteject --forceeject --force→eject: unrecognized option '--force'
eject -F