Skip to content

Instantly share code, notes, and snippets.

@four43 four43/

Last active Aug 29, 2015
What would you like to do?
cron.d script that switches users in order to provide the called script with env vars
0 2 * * * root su --command="./" other-user -l
#RHEL/Fedora/Amazon AMI
0 2 * * * root su --session-command="./" other-user -l
#Install Script
echo " 0 2 * * * root su --session-command=\"./\" other-user -l" | sudo tee /etc/cron.d/my-crond-script
chmod 0644 /etc/cron.d/my-crond-script

This comment has been minimized.

Copy link
Owner Author

four43 commented May 27, 2015

NOTE: Environment variables for the user must go in ~/.profile, not ~/.bashrc. bashrc is only loaded when a new terminal session is created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.