Bash script not working on startup

Hi,

I’m using Kde 5.21.5. Trying to mount an rclone remote on startup. The bash script is:

#!/bin/env bash
export RCLONE_CONFIG_PASS='xxx' && /usr/bin/rclone --vfs-cache-mode writes mount media:"" /home/jshm/mediafolder

Script is located /home/jshm/.config/scripts

When I click this manually it mounts the drive fine. But when I add it to the autostart scripts via System Settings, nothing happens at startup.

I can see the system added a link in .config/autostart-scripts pointing to the script, which works as well when I click it manually.

Is there any way I can view the logs of this script? Or can I add any lines to the script that will print out logs so I can see what’s going wrong?

I have another script which already mounts a different rclone remote without any issues at startup, which is why this is confusing me.

Any help would be appreciated.

Never even heard of rclone before (just had a quick look at the man page though).

How about showing the working script? If one works and the other doesn’t look at the differences, including how they’re run. :slight_smile:

Perhaps try with #!/usr/bin/bash. I assume you’re using the full path to the script.

You could add -v or -vv to the rclone command, and/or read man rclone. Upon further reading, there’s also the –syslog flag. :slight_smile:

export RCLONE_CONFIG_PASS='xxx' && /usr/bin/rclone -v --vfs-cache-mode writes mount media:"" /home/jshm/mediafolder > /path/to/log 2&>1

Where’s the remote path? :confused:

So - what’s the difference between the working one and the non-working one?

2 Likes

Got this working, but not because I figured out what was actually wrong.

After reading the man pages as recommended by @dmt I wondered if this was a cache issue and so changed the cache option from

–vfs-cache-mode writes
to
–vfs-cache-mode minimal

Don’t know why this should make a difference but now the script is working at startup.

Thanks @dmt and @freggel.doe for your responses.

1 Like