Quantcast
Channel: cron ignores variables defined in ".bashrc" and ".bash_profile" - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 9

Answer by gNU.be for cron ignores variables defined in ".bashrc" and ".bash_profile"

$
0
0

You can source the file you want at the top of the script or beginning of the job for the user that is executing the job. The "source" command is a built-in. You'd do the same thing if you made edits to those files to load the changes.

* * * * * source /home/user/.bash_profile; <command>

or

#!/bin/bash
source /home/user/.bash_profile

<commands>

Viewing all articles
Browse latest Browse all 9

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>