crontab command not working code example

Example 1: crontab command not found

## Cron often clears the whole $PATH environment
## So the shell doesn't know where to look for the command

## You should set the $PATH enviorment in crontab:
PATH="/usr/local/bin:/usr/bin:/bin"
0 1 * * * db2 connect to myDB2

## Or add the $PATH enviorment in your script:
#!/bin/bash
PATH="/usr/local/bin:/usr/bin:/bin"

# rest of script follows

Example 2: crontab is not running my shell script

Running a shell script in crontab:
bash -l /path/script.sh