DevHeads.net

@reboot only some lines of a script are working (yum install not)

Hallo,

I m using a script to install docker after a reboot.
The script is starting and working.
The problem:
yum install doesn't work running the script via cron allthough yum
remove works.
Starting the script manual works fine .
Has anyone a hint for me?

Thanks
Ralf

xxx

SHELL=/bin/bash
PATH=/sbin:/bin:/usr/sbin:/usr/bin
MAILTO=root

# For details see man 4 crontabs

# Example of job definition:
# .---------------- minute (0 - 59)
# | .------------- hour (0 - 23)
# | | .---------- day of month (1 - 31)
# | | | .------- month (1 - 12) OR jan,feb,mar,apr ...
# | | | | .---- day of week (0 - 6) (Sunday=0 or 7) OR
sun,mon,tue,wed,thu,fri,sat
# | | | | |
# * * * * * user-name command to be executed

@reboot root
/opt/install_via_pxe/centos_autoinstall/stage01/init_stage01_docker.sh

xxx

#! /bin/bash
echo 'script init_stage01_docker.sh ist gestartet' >>
/var/log/comline/autoinst.log

/usr/bin/yum install -y cifs-utils
systemctl stop packagekit.service
systemctl disable packagekit.service
yum remove PackageKit -y
/usr/bin/yum install -y docker
mv /var/lib/docker /mnt/platte02
cd /var/lib
ln -s /mnt/platte02/docker docker
cp /opt/install_via_pxe/centos_autoinstall/stage01/docker/daemon.json
/etc/docker

systemctl enable docker
systemctl start docker
docker run --rm --privileged -v
/var/run/docker.sock:/var/run/docker.sock -v
/var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.10
<a href="http://192.168.242.x.y/v1/scripts/811F51C097F763ABA2E5:1546214400000:Nzpsvk8sbaKXle3QYotSNzUFk" title="http://192.168.242.x.y/v1/scripts/811F51C097F763ABA2E5:1546214400000:Nzpsvk8sbaKXle3QYotSNzUFk">http://192.168.242.x.y/v1/scripts/811F51C097F763ABA2E5:1546214400000:Nzp...</a>

cp -r /opt/install_via_pxe/centos_autoinstall/stage02/etc/crontab /etc/

echo 'script init_stage01_docker.sh ist gelaufen' >>
/var/log/comline/autoinst.log

shutdown -r now
xxx