By jandante
Hi,
I’ve managed to set up a volume and attached it to my droplet in the storage folder of my project. On boot this is done by fstab by the following line.
/dev/disk/by-id/scsi-0DO_Volume_volume-ams3-01 /path/to/mount-point ext4 defaults,nofail,discard 0 0
However after every reboot I need to set the permissions by performing:
sudo chown -R forge:forge /path/to/mount-point
Otherwise the forge user has no permissions on the volume. Can this be automated and is there a best practice for this?
Thanks in advance.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Accepted Answer
Hey There,
What I can suggest is the following:
touch scriptfile
#!/bin/bash
sudo chown -R forge:forge /path/to/mount-point
chmod +x scriptfile
chmod 755 scriptfile
mv *scriptfile* /etc/init.d/
touch /etc/rc3.d/S01scriptfile
update-rc.d scriptfile defaults
Source - https://raspberrypi.stackexchange.com/questions/15475/run-bash-script-on-startup
As an alternate solution, you can use crontab and set a @reboot line in there - https://www.cyberciti.biz/faq/linux-execute-cron-job-after-system-reboot/
Hope this helps and make sure to let me know if it did!
Best, Dennis
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.