LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 04-01-2020, 06:48 PM   #1
userzero
Member
 
Registered: May 2013
Posts: 56

Rep: Reputation: Disabled
Trying to run rclone command at start-up Debian via /etc/rc3.d


Hello Everyone,


I'm trying to get rclone to auto-mount to Google Drive at system startup but am having some trouble. I put this command in /etc/init.d:

rclone mount --allow-non-empty Polaris: /mnt/Polaris ("Polaris" is my mount directory point in /mnt)

When I run this command manually from the command line it mounts successfully.
I placed that command in an executable file in /etc/init.d and then created a soft link to it in /etc/rc3.d
like this:

ln -s ../init.d/mount-remote S01mount-remote

Again, the file is executable via chmod 755 and resides in /etc/init.d:

-rwxr-xr-x 1 root root 53 Apr 1 16:11 mount-remote

I restart the system and run the "mount" command and don't see it listed. Again, if I just run the command manually, "mount" shows that it is indeed mounted. I'm not sure what I'm missing here. Anyone have any ideas?

Thanks Much!

-chris
 
Old 04-01-2020, 07:07 PM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,784

Rep: Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937Reputation: 5937
What debian version are you running? Anything after version 7 uses systemd if I can remember that far back...

There is no path environment and therefore you need to use the full path to rclone but if using /etc/init.d you really need to use a real LSB init script. In addition debian defaults to runlevel 2 back in the sysv days but your system may be configured differently. If your script is not configured correctly it also might be running before the network is available.

https://wiki.debian.org/LSBInitScripts

If your running a debian version that uses systemd you can create a one time service that runs your command or even use rc.local which is basically the same thing.

Last edited by michaelk; 04-01-2020 at 07:11 PM.
 
Old 04-01-2020, 07:35 PM   #3
userzero
Member
 
Registered: May 2013
Posts: 56

Original Poster
Rep: Reputation: Disabled
Thanks for the reply. I'm running Testing Bullseye. It makes sense that if my command runs before networking is up, it wouldn't make it over to Google Drive. Could I just set my command's run sequence after the network has been initiated? I'm sort of new to this and am looking for the simplest solution.

Thanks again!
 
Old 04-01-2020, 08:07 PM   #4
berndbausch
LQ Addict
 
Registered: Nov 2013
Location: Tokyo
Distribution: Mostly Ubuntu and Centos
Posts: 6,316

Rep: Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002Reputation: 2002
My Debian Buster has a systemd service named rc-local. It is launched after the networking target and runs /etc/rc.local start if /etc/rc.local exists and is executable.

You could put your code in /etc/rc.local, make that file executable and ensure that rc-local.service is enabled.
Code:
echo rclone mount --allow-non-empty Polaris: /mnt/Polaris  >> /etc/rc.local
chmod +x /etc/rc.local
systemctl enable rc-local
In case /etc/rc.local exists already, first check what's inside.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: How To Mount OneDrive In Linux Using Rclone (Supports Personal And Business Accounts) LXer Syndicated Linux News 0 07-26-2018 08:57 PM
rclone query mr_si Linux - Software 3 11-25-2016 08:10 AM
adaptations for rclone install on 14.2 64-bit tfrei Slackware 10 11-05-2016 10:04 PM
rclone & cloud backup under Slackware rkelsen Slackware 4 09-16-2016 12:46 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:14 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration