You are not logged in.

#1 2023-02-24 22:23:14

9acca9
Member
Registered: 2017-02-03
Posts: 51

Run script for Rclone at every reboot (crontab file)

I mount my rclone remote with this:

rclone mount g_escritos_encriptados: /home/myuser/gdrive --vfs-cache-mode full 

i make a script like this then:

cat /home/myuser/scripts/montarclone.sh 
#!/bin/bash
rclone mount g_escritos_encriptados: /home/myuser/gdrive --vfs-cache-mode full 

and get this with crontab -l

crontab -l
SHELL=/bin/sh
@reboot myuser /home/myuser/scripts/montarclone.sh

And get this at reboot:

● cronie.service - Periodic Command Scheduler
     Loaded: loaded (/usr/lib/systemd/system/cronie.service; enabled; preset: disabled)
     Active: active (running) since Fri 2023-02-24 19:04:00 -03; 16min ago
   Main PID: 443 (crond)
      Tasks: 1 (limit: 4334)
     Memory: 2.8M
        CPU: 76ms
     CGroup: /system.slice/cronie.service
             └─443 /usr/bin/crond -n

feb 24 19:04:00 Notfire systemd[1]: Started Periodic Command Scheduler.
feb 24 19:04:01 Notfire crond[443]: (CRON) STARTUP (1.6.1)
feb 24 19:04:01 Notfire crond[443]: (CRON) INFO (Syslog will be used instead of sendmail.)
feb 24 19:04:01 Notfire crond[443]: (CRON) INFO (RANDOM_DELAY will be scaled with factor 62% if used.)
feb 24 19:04:01 Notfire crond[443]: (CRON) INFO (running with inotify support)
feb 24 19:04:04 Notfire crond[472]: pam_unix(crond:session): session opened for user myuser(uid=1000) by (uid=0)
feb 24 19:04:04 Notfire CROND[478]: (myuser) CMD (myuser /home/myuser/scripts/montarclone.sh)
feb 24 19:04:04 Notfire CROND[472]: (myuser) CMDOUT (/bin/sh: line 1: myuser: command not found)
feb 24 19:04:04 Notfire CROND[472]: (myuser) CMDEND (myuser /home/myuser/scripts/montarclone.sh)
feb 24 19:04:04 Notfire CROND[472]: pam_unix(crond:session): session closed for user myuser

What im doing wrong here?

Offline

#2 2023-02-24 22:28:10

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,653

Re: Run script for Rclone at every reboot (crontab file)

The pragmatic answer that does not directly answer your question would be to use systemd timers.
https://wiki.archlinux.org/title/systemd/Timers


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#3 2023-02-24 23:46:50

loqs
Member
Registered: 2014-03-06
Posts: 18,962

Re: Run script for Rclone at every reboot (crontab file)

I would agree with ewaller,  however as you want the command to run at boot I would use a systemd service,  systemd mount or fstab entry which all seem to be supported according to https://rclone.org/commands/rclone_mount/#systemd

Offline

Board footer

Powered by FluxBB