My code didn't work in crontab. I installed new Raspberry Pi OS and write a simple shell script. It still do not work.
I added setup new Raspberry wrote a simple script hello.sh. Setup crontab run every 5 min and nothing happens.
1. Raspberry Pi OS Lite (64 bit)
pi@eve:~ $ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 11 (bullseye)
Release: 11
Codename: bullseye
2. shell script: hello.sh
pi@eve:~ $ chmod 755 hello.sh
pi@eve:~ $ cat hello.sh
#!/bin/bash
# Program:
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin:~/bin
export PATH
echo -e "Hello World! \a \n"
filename="text_file" # File name
date=$(date +%Y%m%d) # Today
file=${filename}${date} # add a file
touch "${file}"
exit 0
3.setup crontab -e
# Edit this file to introduce tasks to be run by cron.
@reboot sleep 10; /usr/bin/printenv > /home/pi/cronenv.txt 2>&1
/5 * * * * /home/pi/hello.sh > /home/pi/cron.log 2>&1
printenv
pi@eve:~ $ cat cronenv.txt
HOME=/home/pi
LOGNAME=pi
PATH=/usr/bin:/bin
LANG=en_GB.UTF-8
SHELL=/bin/sh
PWD=/home/pi
Note: Connect with SSH. Client is Windows 11 PowerShell
dos2unix hello.sh