Last active
March 1, 2020 18:23
-
-
Save jainxy/a2bb20161d990bae9a95f139b9d49400 to your computer and use it in GitHub Desktop.
Crontab tricks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== Use conda environment to run a python script === | |
SHELL=/bin/bash | |
CONDA_PREFIX=/home/code/packages/miniconda3 | |
CONDA_INIT="/home/code/packages/miniconda3/etc/conda/activate.d/proj4-activate.sh" | |
PYTHON=/home/code/packages/miniconda3/bin/python | |
12 13 * * * . $CONDA_INIT ; $PYTHON <python file> | |
=== Use date utility for naming a log file === | |
DATEVAR="date +%Y%m%d_%H%M" | |
17 * * * * echo "logs_$($DATEVAR).txt" | |
=== Crontab logs === | |
sudo cat /var/log/syslog | grep -i cron | grep -i $USER |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment