Answer the question
In order to leave comments, you need to log in
cron scheduler: user script not executing.?
Linux Mint 20.1 Ulyssa (Cinnamon 4.8.6)
The bottom line is this. The scheduler is assigned a regular task of executing a certain scenario when the computer is turned on/rebooted.
Let's say that a simple cleaning of the contents of a file is accepted as a script .bash_history
:
#!/bin/sh
> ~/.bash_history
simple_script
. When "manually" running this file, no errors occur: the required file is cleaned "as it should" ( $./simple_script
--> ok) simple_script
("to be sure"), and in the same place I create an executable file run
, in which it is written:#!/bin/sh
@reboot /etc/cron.daily/simple_script
Answer the question
In order to leave comments, you need to log in
1. The crontab service has a current directory that is different from the one your user is in, so ./simple_script could mean that simple_script should be in the root directory. First, try specifying the full path to the script.
2. In your particular case, you are using the system cron, not the user one. ~/.bash_history will refer to the current user, which in this case will be root
Precisely, root does not clear history on reboot?
Where did /etc/cron.daily come from? Scripts from there start only once a day at a certain time. Use a regular cron list.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question