[SOLVED] Bash scripts to mount & unmount optical drive in Worker?

I'm running XFCE on Arch with the HAL daemon being called in /etc/rc.conf.
I can access media on my optical drive (DVD's or CD's) through the desktop icon that appears after HAL has recognised the drive, VLC automatically does its thing as does NeroLinux.
The reason I'm posting is that I found a great DOpus clone yesterday called Worker - http://www.boomerangsworld.de/cms/worker/index?lang=en, which I am in the process of configuring.
A problem I have is being able to access the optical drive via Worker.
The way it is on my system, with HAL handling it, the first line (see below) appears after HAL mounts the media, which basically makes the two lines below it useless:
/media/<title of disk>
/media/cd
/media/dvd
I have tried configuring Worker to use /media/dvd (or cd), to access the optical media, these don't work for the reason stated above, & /dev/sd0 doesn't work either.
So, do I have to turn off HAL, uncomment the lines in fstab & use mount?
A little bash script, that would do the job for me would be great, as Worker will accept a script or a command string.
I am a bash baby, so if someone can see a solution please post it?
All input welcome.
Thanks.
Last edited by handy (2008-11-19 04:11:02)

Zariel wrote:
i guess something like this?
%optical ALL=(ALL) NOPASSWD: ALL
I found the clues for this in the sudoers manual:
handy   ALL = NOPASSWD: /sbin/umount /CDROM,\
                /sbin/mount -o nosuid\,nodev /dev/cd0a /CDROM
Which works in so far as now mounting no longer needs the password.
Which leaves me with the problem of trying to understand how to get Worker to mount the optical drive on command.
If I enter the bash command in the Terminal as follows:
mount /mnt/dvd
the media is mounted, after which I can push the button in Worker, which I have configured with:
/mnt/dvd
& the root list of the optical media is displayed in the active panel of Worker.
I just haven't been able to get Worker to use "mount /mnt/dvd" yet, there will be a way, I wonder how long it will take me to find it? lol
Last edited by handy (2008-11-19 06:48:09)

Similar Messages

  • Since I upgrade to Lion OS my optical drive stop working can't read or write at all I did what I could to fix it but still not working , any help please

    Since I upgrade to Lion OS my optical drive stop working can't read or write at all I did what I could to fix it but still not working , any help please

    It sounds like you may have multiple problems, but none of them are likely to be caused by malware.
    First, the internet-related issues may be related to adware or a network compromise. I tend to lean more towards the latter, based on your description of the problem. See:
    http://www.adwaremedic.com/kb/baddns.php
    http://www.adwaremedic.com/kb/hackedrouter.php
    If investigation shows that this is not a network-specific issue, then it's probably adware. See my Adware Removal Guide for help finding and removing it. Note that you mention AdBlock as if it should have prevented this, but it's important to understand that ad blockers do not protect you against adware in any way. Neither would any kind of anti-virus software, which often doesn't detect adware.
    As for the other issues, it sounds like you've got some serious corruption. I would be inclined to say it sounds like a failing drive, except it sounds like you just got it replaced. How did you get all your files back after the new drive was installed?
    (Fair disclosure: I may receive compensation from links to my sites, TheSafeMac.com and AdwareMedic.com, in the form of buttons allowing for donations. Donations are not required to use my site or software.)

  • External optical drive that works?

    Hi,  I have had an Imac 27 i5, its 3 weeks old now, I did the free Lion os upgrade before realising that Lion seems to be buggy.
    I have had problems some of which I have got over thanks to this forum, some I have not  I still cant get my isp set-up working but a work-around is giving me service, the wireless connection drops out regularly but using ethernet works. Mail wont send my emails and Itunes is problematic.   The bluetooth trackpad, mouse and keyboard disconnects frequently but thankfully reconnects soon after. Neither of my two existing external hard drives or my external optical drive would work on this Imac,  I replaced one hard drive and that works now,  but tells me that I have 120gb free on a drive that is only 120gb and has a full Time machine backup on it?). I replaced the optical drive with a very cheap one and that works now.
    My old optical drive used Llitescribe and I really want to carry on using it with the Imac,  Can any of you guys recommend an optical drive with Litescribe that will work with the Imac and os Lion?  I am getting tired of having to spend out money replacing things I expected to work with the Mac and dont!
    I brought the Imac because I wanted a hassle free computer, I read and took in all the reasons for using Mac over Microsoft and to be hounest with you the Last 3 weeks have nearly driven me to send the Imac back!   I expected it to "just work"  and be easier to use but it has not turned out that way for me up to now,  I have contacted Apple about the problems and they dont seem to be of very much help - up to now, but thanks to you guys and this forum I am getting things sorted, slowly.  Apple need to get thier act together I think!  What hurts the most is that my 3 year old £600.00. HP PC with windows 7 worked "out of the box" and has "just worked" to this day!  I cannot say that about the £1650.00. Imac!

    The external Apple superdrives are compatible only with the Macs that did not come with an internal optical drive.  Take it back and get a 3rd party drive, preferably one with drawer loading.  I have an 2011 iMac and bought this external drive:  24X OWC Mercury Pro.  I do a lot of ripping of audiobooks for my iPhone so wanted one with a faster read throughput than USB 2 which is all my iMac has. So I use the FW port on the drive.
    OWC is a very well know Mac supplier and has excellent reputation both for item quality and customer support.

  • Optical drive not working only ejecting DVDs

    Hi guys, I have a Macbook Unibody model no MacBook5,1. The thing is a month back the optical drive stopped working. I insert a DVD, its tries to read it for about 15 seconds and ejects it. Now the funny thing is last night i tried playing Dexter on it (great show) and it worked!!! but today i tried playing the same DVD and it does the 15sec eject thing. Now i'm in China, apple care expired about a month ago and i'm looking for a way to fix this with my hands. Any help would be great! Thanks

    Buy an external drive.

  • ITunes8 -- all optical drives stopped working

    After installing iTunes 8, all my optical drives stopped working. Windows simply didn't recognize them. Device manager said they were missing. However the BIOS found them. Uninstalling iTunes8 fixed it.
    However, like everyone else here, now I can't return to a previous version of iTunes because it refuses to recognize my library file (a .itl file).
    Argg
    What can I do, to either use an older version of iTunes, or fix this problem?

    I tried the suggested fix on Apple's site (http://support.apple.com/kb/TS2372?viewlocale=en_US) but both my DVD drives remained invisible.
    Then I tried the one at MS suggested by Adrian Kingsley-Hughes on his ZDNet blog (http://blogs.zdnet.com/hardware/?p=2600):
    http://support.microsoft.com/kb/314060
    Hooray! It worked! Not only have my drives reappeared, but I am burning a DVD right now using InfraRecorder.
    Unfortunately, now I get a nasty message about missing registry data whenever I start iTunes, but I assume Apple will fix this problem in some future release. I'll have to live with it until then.
    I spent hours on this today and almost ordered some new SATA drives, thinking the IDE controller on my mobo must have gone bad. I really appreciate the existence of Adrian's blog and other third party resources!
    And I am very annoyed at Apple right now. Releasing software that breaks peoples' computers in a major way is not acceptable, IMHO. Leaving the bad software out there and posting fixes that don't work is even worse.
    BTW, I am running XP Pro SP2. I have Logitech hardware and software installed, as well as a number of other USB devices (Treo, Canon printer and scanner, iPod) so (according to Adrian and other sources) I guess I was a likely victim.
    Note that, having been burned before by new major releases of iTunes, I was cautious: I held off on installing iTunes 8 until the second release, hoping they'd have fixed any really bad bugs that showed up in the first release by then.
    Silly me.

  • Macbook Pro optical drive stopped working after upgrading from Mac OS X 10.6 Snow Leopard to OS X Mavericks.

    My Macbook Pro optical drive stopped working after upgrading from Mac OS X 10.6 Snow Leopard to OS X Mavericks.. I wonder what's the work around or troubleshooting to fix this. Thanks!

    try and Reset the System Management Controller (SMC)

  • Macbook pro optical drive stopped working after installation of mavericks

    macbook pro optical drive stopped working, just spins and won't eject, ever since I upgraded to Mavericks, thoughts?

    I have the same problem and was advised by someone to reset System Management Controller (SMC). I haven't tried it yet though. I wish it could fix it. Let's give it a shot!

  • Internal optical drive quit working

    My iMac's internal optical drive quit working and does not show in "System Profiler." What can be done to evaluate/fix this?

    Nothing. You'll have to take it somewhere and have it replaced. Or just buy an external USB drive to use in its stead.

  • Script to mount/unmount a USB thumb drive

    I am looking for an applescript to mount or unmount a USB thumb drive.
    I tried:
    tell application "Finder"
    do shell script "diskutil mount /dev/disk1"
    end tell
    This did not work for me

    I tested on a USB stick, no probs, I put my USB stick in a slot, waited for it to mount, ran the script using the "unmount first", then ran the "mount" second worked fine after that using the "unmount " part of the script, I found though that if I right clicked "eject" that the script would not mount the volume.
    You could try something as simple as the below maybe.
    tell application "Finder"
    eject "LEXAR MEDIA"
    end tell
    set _VolumeName to "LEXAR MEDIA"
    set deviceName to do shell script "diskutil list | grep \"" & _VolumeName & "\" | awk '{print $6}'"
    --do shell script "diskutil mountDisk /dev/" & deviceName --mount
    do shell script "diskutil unmountDisk /dev/" & deviceName --unmount
    Budgie

  • Thunar mounting/unmounting NTFS drive in the side pane.

    Hey ,
    Could someone help me to set up Thunar to be able to mount/unmount & browse my NFTS drive "/dev/sda1" "/mnt/HDD" in the side pane?
    Like this:
    I already have a link to it in the side pane:
    But...
    I'd prefer to set it up properly, I've searched google and the bbs but couldn't find any info's on this.
    Thanks

    terminal:
    *diskutil unmount /Volumes/"diskname"*
    apple script:
    tell application "Finder"
    eject disk "diskname"
    end tell
    Keep the quotation marks in the above.
    Mounting a disk is trickier because you need to know the mountpoint.
    First, when the disk is mounted enter the following terminal command:
    df
    this will list all mounted devices.
    locate the line with your disk and read off the first column. It should look something like
    /dev/disk2s2
    Unmount the disk. To mount it run
    *diskutil mount /dev/disk2s2*

  • Bash script to mount/umount usb ?

    this thread https://bbs.archlinux.org/viewtopic.php?id=185712 gave me an idea and teach me.
    I created a script to mount/umount usb. Save it in user's home dir, do
    chmod
    and click on it as a toggle button to mount/umount usb.
    It only work for one usb plugged in. Please suggest me to get it work for two or more.
    #! /bin/bash
    # mr = mounted result
    # ur = umounted result
    # er = empty result
    # cm = check mountpoint
    # cup = check usb is plugged in
    # usb = usb device (Example... /dev/sdb1)
    cm=$(mountpoint /home/username/tmp)
    cup=$(lsblk | grep "sd[b-z]1")
    usb=$(ls /dev/sd[b-z]1)
    er=""
    ur="/home/username/tmp is not a mountpoint"
    mr="/home/username/tmp is a mountpoint"
    if [ "$cm" == "$ur" ] && [ "$cup" != "$er" ]; then
    echo "password" | sudo -S mount -o uid=username,gid=users $usb /home/username/tmp
    elif [ "$cm" == "$mr" ] && [ "$cup" != "$er" ]; then
    echo "password" | sudo -S umount /home/username/tmp
    else
    exit
    fi

    There are a number of issues with your script; the reason you can't mount more than one device is that if "${usb[@]}" is populated by more than one drive, you need to iterate over the array to mount them.
    Other issues that you should consider are:
    your variable names are brief to the point of unintelligble: it is very hard to follow what is going on with "$mr", "$ur", "$cr" etc
    don't parse the output of `ls`
    don't put messages in variables; `printf` them
    relatedly; check exit status, not strings: `$?`
    if you are using bash; see What is the difference between [ and [[?
    rather than `echo`ing your password (see 3), add the script to `sudoers`
    Hope (some of) that helps.

  • Hard drive will not mount after optical drive upgrade

    I recently performed an optical drive install. Had to remove the hard drive bays (I use three hard drives - Luckily, 2 run OSX).
    I carefully removed all three drive bays and the empty bay. When I inserted the drives into the computer I had changed the position, swapping one OSX drive with a different one and reversing the drive bays. On restart, the computer started on the drive I had not selected for startup and I received an error message stating the other drive could not mount and it gave three options (Initialize - Ignore and Eject).
    I can see the drive in Disk Utility and repair the permissions (it's also located in the System Profile).
    I tried a few things I read in the community using various Terminal commands but was unsuccessful.
    (Let me point out that I recently switched from a PPC G5 to MacPro and swapped the drives from PPC into MacPro and all has been fine until I removed changed their positions in the bays)
    Any suggestions/help would be greatly appreciated.

    I would recommend you reformat your drives that you brought over, and if possible put in a Firewie case.
    Swapping drives will normally not matter but you should use Startup Disk to reset the default after using Option key the first time.
    Putting in an optical device shouldn't require removing the drives to get the cage loose and let you put in a 2nd superdirve.
    G5 used APM partition map, Intel Macs use EFI and requie GPT/GUID.
    A drive with just data should not matter but that is not fool-proof either.
    A drive iwth the system from a G5 though can.
    During startup the boot process scans all volumes and looks for systems and mountable volumes.
    Pull all the drives except the one with OS X that you were using, and put that in bay #1.
    I've moved arrays between bays and that never "broke" the array or had trouble mounting and using (even moving to ODD ports).

  • Air/Retina Mac's Won't Mount External Optical Drives

    Please Help.  I recently upgraded hardware from a 2009 MBP and a 2007 MBP.  My current problem is that on the i7 Air and i7 MBP w/ Retina it will no longer recognize USB Optical Drives on 10.8.2.  It was crashing my i7 Air (panic attack-grey screens), so I returned and went with the Pro after store consult.  I take the same hardware and plug it into my old machines and it works fine, running the same 10.8.2. 
    I have read many forum posts around the net and shown various solutions (flashing RAM, etc.).  All of which have not worked on my setup, and the drive will still not mount.  I have tried 2 seperate optical drives, 1 Blu-Ray and 1 DVD (Apple Superdrive - now returned). 
    Is there some tie to this issue and the fact that both the Air and MBP w/ Retina do not natively have optical drives?  If so, is there some solution that can be performed to properly address this issue.  This is a reasonable use case and I do not want the models with optical drives.  Kinda surprised considering that Apple is pushing us to this no optical drive world that they would not support external ones inclduding their superdrive, which doesn't work in this case.

    Duplicate post.  Answered here: http://forums.macrumors.com/showthread.php?t=1614533

  • Shell script to mount/unmount Vista laptop samba shares?

    I have a couple Vista laptops in the house that I take to the office regularly, and currently I use Dolphin to browse into the laptop and xfer files back and forth, but I really don't want to use dolphin, I'd rather set up some kind of script/alias that can prompt me to mount and unmount the share instantly in shell, instead. Is this possible or do I just have to do it in fstab and issue mount/unmount commands everytime?
    TIA for any help

    I tested on a USB stick, no probs, I put my USB stick in a slot, waited for it to mount, ran the script using the "unmount first", then ran the "mount" second worked fine after that using the "unmount " part of the script, I found though that if I right clicked "eject" that the script would not mount the volume.
    You could try something as simple as the below maybe.
    tell application "Finder"
    eject "LEXAR MEDIA"
    end tell
    set _VolumeName to "LEXAR MEDIA"
    set deviceName to do shell script "diskutil list | grep \"" & _VolumeName & "\" | awk '{print $6}'"
    --do shell script "diskutil mountDisk /dev/" & deviceName --mount
    do shell script "diskutil unmountDisk /dev/" & deviceName --unmount
    Budgie

  • [SOLVED]bash script

    I had created a bash script which ensures that each of the applications has one instance. The problem is no applications are executed during startup. Here is my script:
    if [ -z "ps aux | grep wmCalClock | head -n -1" ]
    then
    wmCalClock -b 100 -arial -tc cyan -bc black -e xterm &
    fi
    if [ -z "ps aux | grep wmfire | head -n -1" ]
    then
    wmfire -L1 -B1 -s0 -C2 -P fireload_temp &
    fi
    if [ -z "ps aux | grep wmcpuload | head -n -1" ]
    then
    wmcpuload -lc red -a 95 &
    fi
    if [ -z "ps aux | grep wmmemload | head -n -1" ]
    then
    wmmemload -lc red -am 95 &
    fi
    Last edited by heyya (2009-12-25 04:19:33)

    Well, obviously not, as the string "ps aux | grep wmCalClock | head -n -1" is
    never empty What you probably wanted to write is
    "$(ps aux | grep wmCalClock | head -n -1)"
    This will put the output of the script into the string, rather than taking the
    command string itselft.

Maybe you are looking for