this post was submitted on 09 May 2024
25 points (96.3% liked)
linux4noobs
1356 readers
1 users here now
linux4noobs
Noob Friendly, Expert Enabling
Whether you're a seasoned pro or the noobiest of noobs, you've found the right place for Linux support and information. With a dedication to supporting free and open source software, this community aims to ensure Linux fits your needs and works for you. From troubleshooting to tutorials, practical tips, news and more, all aspects of Linux are warmly welcomed. Join a community of like-minded enthusiasts and professionals driving Linux's ongoing evolution.
Seeking Support?
- Mention your Linux distro and relevant system details.
- Describe what you've tried so far.
- Share your solution even if you found it yourself.
- Do not delete your post. This allows other people to see possible solutions if they have a similar problem.
- Properly format any scripts, code, logs, or error messages.
- Be mindful to omit any sensitive information such as usernames, passwords, IP addresses, etc.
Community Rules
- Keep discussions respectful and amiable. This community is a space where individuals may freely inquire, exchange thoughts, express viewpoints, and extend help without encountering belittlement. We were all a noob at one point. Differing opinions and ideas is a normal part of discourse, but it must remain civil. Offenders will be warned and/or removed.
- Posts must be Linux oriented
- Spam or affiliate links will not be tolerated.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Here's the documentation I created for myself seventeen years ago. It's from the perspective of a Mac user with hardly any command-line knowledge, so I was distilling things I'd learned researching all over the web that morning. Some of it may be inaccurate on technical details due to my finite understanding at the time. Hope this helps.
Mounting noauto drives using diskutil.
The challenge is how to automate the mounting of drives that have a noauto configuration in /bin/fstab.
One would normally mount these drives by using diskutil list to display the device-id of the unmounted drives. The drives could then be mounted by using diskutil mount device-id. Unfortunately, the device-id is not static and this is ,therefore, not viable for automation. The solution is to employ a shell script to mount the drives by their name.
Step 1: Creating the shell script Start by creating the script in the directory /bin/
The following is the basis for the shell script:
Using this code, mounter.sh would be able to mount the disk "120GB" by calling its name anywhere in the command line. However, any call to diskutil run through cron will result in the following notification to /var/mail/danyoung :
The solution is use of an absolute path, as cron does not run as a shell environment. The call must be made as:
The completed shell script looks like this:
Step 2: Make executable After saving the file it must be made an executable:
Step 3: Add to cron Add the script to cron using Cronnix. The command to execute is simply the path to the shell script:
Further notes:
The shell script was discovered in an example at radiotope.com but was missing the absolute path. The solution of using an absolute path was given in a forum at macosxhints.com. The exact pages follow: 1. http://www.radiotope.com/writing/?p=64 2. http://forums.macosxhints.com/showthread.php?s=b0306f161f40e5ea07b2eea9f18ad2f2&t=60811
Additional information about writing a first shell script and making it executable was at the following: 1. http://www.macdevcenter.com/pub/a/mac/2002/07/02/terminal_5.html
Whats the difference between using backticks for the definition of theDisk and $() ?
The backticks are an old way of creating a variable that is no longer considered good form. But I didn't know any better at the time.