fuse_load="YES"
@reboot Run once, at startup of cron.
Actually, this is the 'old' way of doing it. Only put drivers in loader.conf that are essential for the system to boot. Everything else can be added toThe best way to load kernel module is /boot/loader.conf
kld_list
in rc.conf:kld_list="fuse"
/bin/bash doesn't exist on FreeBSD. And don't use bash for such a simple script in any case.Code:#!/bin/bash
Don't use /mnt for (semi)permanent mounts, it's for temporary mounts. And just add this to /etc/fstab:Code:sudo ntfs-3g /dev/ada2s1 /mnt/ -o -ro
/dev/ada2s1 /somedir/ntfs/ ntfs mountprog=/usr/local/bin/ntfs-3g,late,ro 0 0
Also methinks everything in /usr/local/etc/rc.d/* which has "sh" extension is executed.
In addition, you better use full path in scripts unless you set up the environment for your script. In your casesudo
and other commands are unlikely to be found.
Startup scripts are all executed as root, no need for sudo(8).I need to execute a command with sudo at the startup in the script
You did not understand what I was saying. I tried to tell you scripts which are executed outside of user or root environment may not have $PATH set.I need to execute a command with sudo at the startup in the script
In case of using system crontab /etc/crontabSimple example crontab:
@reboot /home/username/script.sh
@reboot root /home/username/script.sh
setenv EDITOR ee
crontab -u root -e
@reboot /home/username/script.sh
Thank you! Its working!In case of using system crontab /etc/crontab
Try to add the line like this:Code:@reboot root /home/username/script.sh
In case of using user's crontab ( root has user's crontab too ):
Run these commands. Root's crontab will be opened with ee() editor.
setenv EDITOR ee
crontab -u root -e
By then add the line like this:Code:@reboot /home/username/script.sh