You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried running the shell script plugin as user service. When running the first command in my shell script source activate anaconda_env_name it fails because it can't find source. However, if I start the shell script with PATH=/data/anaconda/envs/anaconda_env_name/bin:$PATH it works.
Is there a way to use all environment variables of the user running the job instead of the root user?
Thanks!
Steps to reproduce the problem
Modify shell script plugin to run as user X
Create job which relies on environment variable set for user X but not for root user
Run job
Your Setup
Ubuntu server running cronicle as master and ubuntu server as slave running job
Operating system and version?
Ubuntu 16
Node.js version?
10.10.0
Cronicle software version?
0.8.28
Are you using a multi-server setup, or just a single server?
Single Server
Are you using the filesystem as back-end storage, or S3/Couchbase?
File system
Can you reproduce the crash consistently?
Yes
The text was updated successfully, but these errors were encountered:
Thanks for the issue report. I don't think there is a good way to load all the environment variables for a given user, and have it work across operating systems and shells. As I understand it they all do it differently (~/.profile and ~/.bash_profile come to mind). I think there are other places the user's environment variables can be stored as well. Actually "logging in" a user as one would in a Terminal is not something Cronicle can actually do (I'm not even sure how to do it). It just changes the permissions so it can execute scripts and write files as that target user.
Here are some things you can do. First, if you want to globally set that PATH for all your events, you can do it in your main Cronicle configuration file. Just set the job_env configuration property, and include your PATH in there. Example:
Unfortunately this method doesn't expand inline variables, so you can't prepend or append to the existing $PATH. You'll have to explicitly specify all the paths like /usr/bin etc.
Another thing you can do is try to execute the user's ~/.profile file (or wherever this exists in your OS and your shell). I believe you can do this by placing this command at the top of your shell script (under the Shebang line):
#!/bin/bashsource~/.profile
# Your shell script here
Note that I have no idea which OSes or shells support this file. I seem to recall in some cases I've seen it called ~/.bash_profile instead. This file may include the target user's PATH additions, but again, I really have no idea. I am sort of grasping at straws here.
Summary
I tried running the shell script plugin as user service. When running the first command in my shell script
source activate anaconda_env_name
it fails because it can't find source. However, if I start the shell script withPATH=/data/anaconda/envs/anaconda_env_name/bin:$PATH
it works.Is there a way to use all environment variables of the user running the job instead of the root user?
Thanks!
Steps to reproduce the problem
Your Setup
Ubuntu server running cronicle as master and ubuntu server as slave running job
Operating system and version?
Ubuntu 16
Node.js version?
10.10.0
Cronicle software version?
0.8.28
Are you using a multi-server setup, or just a single server?
Single Server
Are you using the filesystem as back-end storage, or S3/Couchbase?
File system
Can you reproduce the crash consistently?
Yes
The text was updated successfully, but these errors were encountered: