My cron job needs to run a shell script which calls python commands which depends on python and a pip package. How can I get my script to work in cron?
My shell script is simply
#!/bin/bash
TOKEN=XXXX-XXXX-XXXX
bdate=$(date -d "$date -30 days" +"%Y%m%d")
# slack-cleaner was installed with pip install slack-cleaner
slack-cleaner --token $TOKEN --message --channel ci-builds --botname circle-ci --before $bdate
My crontab is
50 3 * * * bash /home/myuser/bin/slack_cleaner.sh
I get the errors in the mail log
tail -f /var/mail/myuser # outputs
X-Cron-Env: <HOME=/home/myuser>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=myuser>
Message-Id: <20210108034301.5F00F44531@someplace>
Date: Fri, 8 Jan 2021 03:43:01 +0000 (UTC)
/home/myuser/bin/slack_cleaner.sh: line 5: slack-cleaner: command not found
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…