How can I open a shell in the environment that cron (alternatively launchd) uses to execute commands?

Clash Royale CLAN TAG#URR8PPP
up vote
0
down vote
favorite
I am trying to get launchd (which is macOS's alternative for cron) to run a job for me. It doesn't work, while running the commands on a bash launched with sudo does. I tried redirecting the output to files, but examining them hasn't enlightened me, either. I like to have access to this 'primal' environment launchd uses to execute commands, so that I can experiment directly there and see what is missing.
PS: Here is the script I run in my launchd job (as root):
#!/usr/bin/env bash
export HOME=/Users/evar
source /users/evar/.bashrc
/Users/evar/anaconda/bin/python /Base/_Code/Misc/hosts/updateHostsFile.py --auto --replace --backup &> /Users/evar/log/hosts.out2
# tmux new -d -s hosts "/Users/evar/anaconda/bin/python /Base/_Code/Misc/hosts/updateHostsFile.py --auto --replace --backup" # I tried this, but sudo tmux kept saying no sessions while logs kept said "duplicate session hosts".
bash shell sudo cron anaconda
add a comment |Â
up vote
0
down vote
favorite
I am trying to get launchd (which is macOS's alternative for cron) to run a job for me. It doesn't work, while running the commands on a bash launched with sudo does. I tried redirecting the output to files, but examining them hasn't enlightened me, either. I like to have access to this 'primal' environment launchd uses to execute commands, so that I can experiment directly there and see what is missing.
PS: Here is the script I run in my launchd job (as root):
#!/usr/bin/env bash
export HOME=/Users/evar
source /users/evar/.bashrc
/Users/evar/anaconda/bin/python /Base/_Code/Misc/hosts/updateHostsFile.py --auto --replace --backup &> /Users/evar/log/hosts.out2
# tmux new -d -s hosts "/Users/evar/anaconda/bin/python /Base/_Code/Misc/hosts/updateHostsFile.py --auto --replace --backup" # I tried this, but sudo tmux kept saying no sessions while logs kept said "duplicate session hosts".
bash shell sudo cron anaconda
add a comment |Â
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to get launchd (which is macOS's alternative for cron) to run a job for me. It doesn't work, while running the commands on a bash launched with sudo does. I tried redirecting the output to files, but examining them hasn't enlightened me, either. I like to have access to this 'primal' environment launchd uses to execute commands, so that I can experiment directly there and see what is missing.
PS: Here is the script I run in my launchd job (as root):
#!/usr/bin/env bash
export HOME=/Users/evar
source /users/evar/.bashrc
/Users/evar/anaconda/bin/python /Base/_Code/Misc/hosts/updateHostsFile.py --auto --replace --backup &> /Users/evar/log/hosts.out2
# tmux new -d -s hosts "/Users/evar/anaconda/bin/python /Base/_Code/Misc/hosts/updateHostsFile.py --auto --replace --backup" # I tried this, but sudo tmux kept saying no sessions while logs kept said "duplicate session hosts".
bash shell sudo cron anaconda
I am trying to get launchd (which is macOS's alternative for cron) to run a job for me. It doesn't work, while running the commands on a bash launched with sudo does. I tried redirecting the output to files, but examining them hasn't enlightened me, either. I like to have access to this 'primal' environment launchd uses to execute commands, so that I can experiment directly there and see what is missing.
PS: Here is the script I run in my launchd job (as root):
#!/usr/bin/env bash
export HOME=/Users/evar
source /users/evar/.bashrc
/Users/evar/anaconda/bin/python /Base/_Code/Misc/hosts/updateHostsFile.py --auto --replace --backup &> /Users/evar/log/hosts.out2
# tmux new -d -s hosts "/Users/evar/anaconda/bin/python /Base/_Code/Misc/hosts/updateHostsFile.py --auto --replace --backup" # I tried this, but sudo tmux kept saying no sessions while logs kept said "duplicate session hosts".
bash shell sudo cron anaconda
bash shell sudo cron anaconda
asked 25 mins ago
HappyFace
22710
22710
add a comment |Â
add a comment |Â
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f478718%2fhow-can-i-open-a-shell-in-the-environment-that-cron-alternatively-launchd-uses%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password