# Simple bash script problem



## bigart (Feb 7, 2021)

I'm trying to make bash script.

This command working fine from command line:
"/usr/local/bin/rclone mount Dropbox: /dane/Dropbox/ --vfs-cache-mode=writes --allow-other --config /root/.config/rclone/rclone.conf

I want to execute this command with system startup and I did simple script.



```
#!/bin/sh
# PROVIDE: rclone
. /etc/rc.subr
name="rclone"
start_cmd="${name}_start"
stop_cmd="${name}_stop"
rclone_start() {
   echo "rclone starting"
   # your commands here
#/usr/local/bin/rclone mount Dropbox: /dane/Dropbox/ --vfs-cache-mode=writes --allow-other
command="/usr/local/bin/rclone mount Dropbox: /dane/Dropbox/ --vfs-cache-mode=writes --allow-other --config /root/.config/rclone/rclone.conf"
#command_args
}
rclone_stop() {
   echo "rclone stopping"
   # your commands here
umount -f /dane/Dropbox/
}
load_rc_config ${name}
run_rc_command "$1"
```

line without `command=`  parameter working but after `service rclone start` not going to "background" after execute.
when I put `command=` before script not working

I tried also parameters below:


```
command="/usr/local/bin/rclone";
command_args="mount Dropbox: /dane/Dropbox/ --vfs-cache-mode=writes --allow-other --config /root/.config/rclone/rclone.conf";
```

Sorry, I'm newbie and I'm almost sure there is very simple mistake, but I don't know where ?


----------



## unitrunker (Feb 7, 2021)

FYI - this is a Bourne shell script - which is fine because that's what rc uses.

Add a "REQUIRE" comment just after the shebang. rclone probably requires the network to be up.

# REQUIRE: NETWORKING

This will allow rcorder to run your service after networking is up and running.

See section 7:









						Practical rc.d scripting in BSD
					

A guide to writing new rc.d scripts and understanding those already written




					docs.freebsd.org


----------



## unitrunker (Feb 7, 2021)

If rclone offers any diagnostic logging, you may want to turn that on.


----------



## ShelLuser (Feb 7, 2021)

If you only want to run a single command during system startup then why not simply rely on crontab(5)? It'll be much easier, look into the @reboot setting.


----------



## Jose (Feb 7, 2021)

I use rc.local for one-liners at startup.


----------



## im (Feb 7, 2021)

Thread "How to run a simple script on startup"








						Solved - Help to run a simple script on startup
					

How can run this script on startup?  #!/bin/bash    sudo kldload fuse sudo ntfs-3g /dev/ada2s1 /mnt/ -o -ro xdg-open /mnt/ &> /dev/null




					forums.freebsd.org


----------

