Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.

To add on to tripleee's answer, you can cause all of your crons to be evaluated in bash (or the shell of your choice) by specifying the shell in the crontab.

SHELL=/bin/bash * * * * * . $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log; 

edit and if you really want to see what it's doing, the following command should make it sufficiently verbose:

/bin/bash -x -c '. $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log' > /tmp/cron.`date +%s`+\%s` 

set -x or the -x flag on the commandline will cause most shells to print every line evaluated.

To test on the commandline remove the \ from the date command. This is needed to prevent cron from evaluating %s as standard input.

To add on to tripleee's answer, you can cause all of your crons to be evaluated in bash (or the shell of your choice) by specifying the shell in the crontab.

SHELL=/bin/bash * * * * * . $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log; 

edit and if you really want to see what it's doing, the following command should make it sufficiently verbose:

/bin/bash -x -c '. $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log' > /tmp/cron.`date +%s` 

set -x or the -x flag on the commandline will cause most shells to print every line evaluated.

To add on to tripleee's answer, you can cause all of your crons to be evaluated in bash (or the shell of your choice) by specifying the shell in the crontab.

SHELL=/bin/bash * * * * * . $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log; 

edit and if you really want to see what it's doing, the following command should make it sufficiently verbose:

/bin/bash -x -c '. $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log' > /tmp/cron.`date +\%s` 

set -x or the -x flag on the commandline will cause most shells to print every line evaluated.

To test on the commandline remove the \ from the date command. This is needed to prevent cron from evaluating %s as standard input.

notations on -x shell script debugging.
Source Link
Andrew Domaszek
  • 5.2k
  • 1
  • 18
  • 27

To add on to tripleee's answer, you can cause all of your crons to be evaluated in bash (or the shell of your choice) by specifying the shell in the crontab.

SHELL=/bin/bash * * * * * . $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log; 

edit and if you really want to see what it's doing, the following command should make it sufficiently verbose:

/bin/bash -x -c '. $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log' > /tmp/cron.`date +%s` 

set -x or the -x flag on the commandline will cause most shells to print every line evaluated.

To add on to tripleee's answer, you can cause all of your crons to be evaluated in bash (or the shell of your choice) by specifying the shell in the crontab.

SHELL=/bin/bash * * * * * . $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log; 

To add on to tripleee's answer, you can cause all of your crons to be evaluated in bash (or the shell of your choice) by specifying the shell in the crontab.

SHELL=/bin/bash * * * * * . $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log; 

edit and if you really want to see what it's doing, the following command should make it sufficiently verbose:

/bin/bash -x -c '. $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log' > /tmp/cron.`date +%s` 

set -x or the -x flag on the commandline will cause most shells to print every line evaluated.

Source Link
Andrew Domaszek
  • 5.2k
  • 1
  • 18
  • 27

To add on to tripleee's answer, you can cause all of your crons to be evaluated in bash (or the shell of your choice) by specifying the shell in the crontab.

SHELL=/bin/bash * * * * * . $HOME/.bash_profile; . $HOME/.bashrc; env > $HOME/env.log;