Home > Mobile >  Cron -bash: 0: command not found
Cron -bash: 0: command not found

Time:02-22

I feel very dumb but why does it not work when I just want to use a simple Linux command in a crontab?

0 0 0 * * ? ls /data/synology/multimedia/movies > /data/storage/backup/movies.txt 2>&1

This ends up in -bash: 0: command not found. Why is ls not found? What is wrong?

CodePudding user response:

You are not specifying a command to bash. It thinks 0 is the name of the program you want to run.

CodePudding user response:

try this one. use absolute path of ls .

first of all find the absolute path with whereis ls then add crontab as below.

0 0 0 * * /bin/ls /data/synology/multimedia/movies > /data/storage/backup/movies.txt 2>&1
  • Related