R
R
rtest2018-10-25 10:00:55
bash
rtest, 2018-10-25 10:00:55

How to specify TCL environment variables when running bash script from cron?

Good afternoon.
The situation is as follows:
there is a script organized through expect for remote authorization on git.
I run it by hand - everything works fine.
I put in crontab - it starts in a different environment and resp. gets lost along the way.
I tried to set environment variables forcibly at the beginning of the script - it doesn't help. Tried under different users - zero effect. I broke it into two scripts, calling one from the other - it did not help. "cd" does not work as it should - it does not want to go to the specified path, it tries to execute the insides of the script somewhere in its /root.
How can I explain to him that I need to go to the right folder and work out "git pull" there?
Thank you.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Saboteur, 2018-10-25
@saboteur_kiev

Somehow you were executing the cd command and environment variables incorrectly.
Everything should work great.
1. Give an example script
2. Instead of expect, remote authorization on git can be configured via ssh, via ssh keys, then everything works automatically and reliably.

B
Boris Syomov, 2018-10-25
@kotomyava

Are you running your script in the cron under that user?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question