I need to run, on Ubuntu 18.04, via cron a script, myscript.sh
that contains, among other things, installation instruction for another script, pluckeye-linux-0.99.40.installer
and I'm running into a tedious error:
The script in question is the installer for Pluckeye a kind of parental control app. This needs to be run as root. Inside of myscript.sh
I have placed
cd "/path/to/pluckeye/"
./pluckeye-linux-0.99.40.installer
When I run
sudo crontab -e
and place there* 20 * * * "/path/to/myscript.sh"
then Pluckeye's installer returns a cryptic error (I'm redirecting the outputs of what cron execute to a file, so that I can see what went wrong):
0b8e:24: ca151e1e WARNING 32512 0b8e:33: ca151e1e WARNING 0x30b8e019 0b8e:42: ca151e1e WARNING 0x30b8e019 0b8e:78: ca151e1e WARNING 0x30b8e019 0c2c:14: ca151e1e WARNING 0x30b8e019 0b4c:20: ca151e1e WARNING 0x30b8e019 0c70:48: ca151e1e WARNING 0x30b8e019 FAILED TO INSTALL: 6400
But when I run the installer normally in my shell with
sudo
(otherwise it will immediately return and errorI need to be invoked by root
FAILED TO INSTALL: 11520
) it works without any problems.
I assume this comes from the fact that cron uses its own, minimal environment. I have tried various things I found on the internet, like using instead of the above
* 20 * * * . $HOME/.profile; "/path/to/myscript.sh"
hoping to get the installer to work now, but that changes nothing. I would not like to place sudo
inside the script, meaning
cd "/path/to/pluckeye/"
sudo ./pluckeye-linux-0.99.40.installer
as I have read that that introduces a security risk.
What do I need to do to get Pluckeye to install itself via cron?