Cant execute expect script with cron job, but works in terminal

Hi there,

I know some people asked a similar question, but I got no answer to solve my problem.

I’m trying to auto-backup my bitwarden vault with a shell script I found.

to type the user input automatically, I use a “expect” script.

its working fine if I execute the expect script via terminal, but when I execute it with a cron job, it says:

Line 44: bw: command not found.
Line 49: bw: command not found.
Line 57: bw: command not found.

“bw” is the bitwarden CLI, to export the vault.

I know that cron uses simpler syntax and maybe I need to call the environment in my scripts, but my scripts already begin with #!/bin/bash and #!/usr/bin/expect, so I dont know what to do.

My crontab command looks like this:
*/2 * * * * /home/user/Documents/Bitwarden_Export/input.exp

I’m not very familiar with scripts, so hopefully someone can write a bit more clear what to do :slight_smile:

Thank you in advanced!

You may need to use the full path for commands in the script.

1 Like

oh dear, thanks!
I thought about the full script location, but never of the bitwarden CLI location.

Now it works, thanks a lot! :smiley: