[Raspbian] Client Autostart before Login

Hello everybody,

I am running a fresh installation of the latest Raspbian Stretch on a Raspberry Pi 2B. Today, I built the Nextcloud client according to the installation instructions from this site (section: Building on Debian): https://github.com/nextcloud/client_theming
Client version is 2.3.2.

So far, the client works just fine and it synchronizes well with the server.
However, I need to sign in into my Raspbian Account on the Pi in order to have the Nextcloud client start up. What I want to have, is some kind of a ‘background’ connection, so that the Nextcloud client syncs with the server, even when I am not logged in as a user on the Raspberry Pi! So instead of waiting until I sign into the Pi, I want to sync my files with the Pi as soon as the Pi has established internet connection.
Is there a way to do that?

I already checked the following steps:

1.) In the Nextcloud client settings (GUI), tab ‘General’, the option “Launch on System Startup” is already checked

2.) I tried to ‘manually’ start the nextcloud client on boot by doing the following:
Making file “start.sh” in /home with:
cd /usr/bin

and then editing the file “/etc/rc.local” by adding the line:
su pi -c “/home/user/start.sh”

However, the client does not start before I log into my Linux account.

If anybody has a suggestion on how to manage this, please reply!

Have a great day everyone!

What exactly do you try with your raspberry pi? :smiley:
Maybe you need to set autologin to 1.

I want to use the Pi as a backup server. It shall sync specific data with the server, without me logging into my user account on the Pi. So I want to be logged off as a user on the Pi, that is running 24/7, but the Nextcloud client shall sync while I am logged off.

Autologin might be an option, but I specifically want to remain logged off during synchronisation. This should be possible too, right?

You can use Cronjobs/-tabs or when you want you can edit your rc.local

sudo nano /etc/rc.local

when you just want to start a program before autologin. Enter your code there before exit 0.

Edit sry: I forgot to recognize your priviously posts.

Try it with sudo -u pi -c "/home/user/start.sh"
For what is the -c flag?

Hello again,

did not have time to look into this much further, so this topic is still active.

First off, thank you STrike for your reply.

"Try it with sudo -u pi -c “/home/user/start.sh"
For what is the -c flag?”

The sudo -u pi -c “path/start.sh” command in the /etc/rc.local file did not work. I want to emphasize that superuser permissions are not necessary to execute the start.sh script.
Maybe I did not understand what to enter in the rc.local file. I understand that the command has to be inserted in rc.local right before the “exit 0” line, however I think I missed the basic principle of what to insert here.
So: What would the command in rc.local look like, if I wanted to run the start.sh shell script on boot? Shouldn’t I be able to just enter /home/user/start.sh and be done with it? I cannot try that right now, but I will later today and get back to this thread.