Answer the question
In order to leave comments, you need to log in
Linux crontab not running script?
Hello, please tell me what could be wrong?
I enter crontab -e in the terminal
, an empty file is opened for entering commands, I enter
0 0 * * * zip -P 12345 /home/user/Desktop/Composer/Composer.zip "/media/user/ASUS/arch.ctx"
the command does not work , once a day
, but if you enter
zip -P 12345 /home/user/Desktop/Composer/Composer.zip "/media/user/ASUS/arch.ctx" in the terminal,
then the archive is created
Answer the question
In order to leave comments, you need to log in
Standard error number 1 in cron: unlike the terminal, there is no PATH in it, so you need to write the full paths to any program you run.
cron does not have path variables by default, so it simply does not know where the zip
is, you need to specify the full path to the zip command and everything will work.
find out where in your OS it lies easily
which zip
after that specify the full path in my case it is
/usr/bin/zip zip -P 12345 ....
service crond restart or reload after editing the task you need to do - if you don't.
Probably does not depend on the distribution, but still what kind of system?
It is not specified from which user to run the command!
In debian like this, something like this
* 16 * * * root /path/to/command/or/script/script.sh
In the script itself, all the commands with arguments and a few are already there.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question