Updating my self hosted docker automatically using cron - not working

I have been trying to get the cron job to work under the user that will allow updating to the Bitwarden instance under a standard docker build.

I have referred tot his document → Update your Instance | Bitwarden Help Center.

I have even tried testing it by outputting the command to a text file, e.g.,
cd /opt/bitwarden/
./date >> /opt/bitwarden/updateself.log
./opt/bitwarden/bitwarden.sh updateself >> /opt/bitwarden/updateself.log
./date >> /top/bitwarden/update.log
./opt/bitwarden/bitwarden.sh update >> /opt/bitwarden/update.log

-rw-rw-r-- 1 bitwarden bitwarden 0 Oct 29 02:00 update.log
-rw-rw-r-- 1 bitwarden bitwarden 0 Oct 29 02:00 updateself.log

(under the user that can run the ‘update & updateself’ commands)
crontab -e
0 2 * * 0 /opt/bitwarden/updatebw.sh

But this does not do anything I have now been trying to find out how to run the command under another user, but am unable find anything useful.

Can anyone help with this?
Has anyone completed this step, to keep the Bitwarden instance update to date without being physically present?

I run Ubuntu, and have installed Docker standard install using the directions provided by Bitwarden.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.6 LTS
Release: 20.04
Codename: focal

any help is appreciated. thansk you in advance.

I am no expert in these matters… But have you checked you have the execute flag on your updatebw.sh?

this was one of the first bits I made sure of, I did try and run this manually before inputting the details into crontab, remembering to put the entire file path as well from root.

thanks for your input.

In my script I do not have any “.” preceding the /opt… Not sure if this is required on Ubuntu? I am running on CentOS.
Also, you have a typo on line 5:
./date >> /top/bitwarden/update.log
You could try modifying the script and remove the preceding dots
Only other difference I have is I put the script in /opt/bitwarden/bwdata/scripts folder.

you may well be right on not needing the “.” preceding the /
I have now removed this from all lines, this may well be the reason why none of the command worked at all.

oh, and thanks for spotting the typo :slight_smile:

thanks for the information, removing the “.” did the trick, it is now up to date and did so over the weekend, thanks once again