Quantcast
Channel: Run bash_profile in cron job - Server Fault
Viewing all articles
Browse latest Browse all 4

Answer by cjc for Run bash_profile in cron job

$
0
0

bash /root/.bash_profile will create a new bash process, run that file (and I assume set your env variables while doing so), and then exit, taking those newly set env variables with it.

Try . /root/.bash_profile. Or source /root/.bash_profile. That will execute the file in the current bash process, so your env variables will be available to the current process.

You may also want to use #!/bin/bash instead of #!/bin/sh if you're going to do bash-style invocations.


Viewing all articles
Browse latest Browse all 4

Trending Articles



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