I have an auto install bash script triggered by cron, when some condition is met, the install process is triggered. It essentially looks like this:
#!/bin/bash if [[ -f "/usr/bin/apt-get" ]]; then if [[ ! -f "/usr/bin/dstat" ]]; then apt-get update && apt-get install -y dstat > /tmp/dstat.log fi fi The script above is intended to install dstat if it is found not installed. If I manually run this script, everything works as expected. The output looks in /tmp/dstat.log like:
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: dstat 0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded. Need to get 0 B/68.2 kB of archives. After this operation, 351 kB of additional disk space will be used. Selecting previously unselected package dstat. (Reading database ... 33233 files and directories currently installed.) Preparing to unpack .../dstat_0.7.2-3build1_all.deb ... Unpacking dstat (0.7.2-3build1) ... Processing triggers for man-db (2.6.7.1-1ubuntu1) ... Setting up dstat (0.7.2-3build1) ... dstat is installed successfully. Now I add a new entry in crontab and let this script run periodically. I found dstat is not installed, the output looks like:
Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: dstat 0 upgraded, 1 newly installed, 0 to remove and 13 not upgraded. Need to get 0 B/68.2 kB of archives. After this operation, 351 kB of additional disk space will be used. I'm really confused.
jqagain, it also does not work. Sorry in my original post I saidjqworked whiledstatdid not, which was a wrong statement. I have fixed in the original post.-ybut be careful...