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

Comments

Re: @reboot only some lines of a script are working (yu

By Mogens Kjaer at 01/10/2019 - 13:23

On 1/10/19 11:32 AM, Ralf Prengel wrote:
Is the network up when the script executes?

Mogens

Re: @reboot only some lines of a script are working (yu

By Ralf Prengel at 01/14/2019 - 02:26

Zitat von Mogens Kjaer < ... at lemo dot dk>:

Hallo,

yes it is up.
Result of 10 pings is fine as first line in the script.
Any other ideas?

Ralf

Re: @reboot only some lines of a script are working (yu

By Anthony at 01/15/2019 - 10:48

On 14/1/19 5:26 pm, Ralf Prengel wrote:

Maybe there's something in the install process that needs a tty - maybe
try running it in a screen session???

Re: @reboot only some lines of a script are working (yu

By Anthony at 01/15/2019 - 10:49

On 16/1/19 1:48 am, Anthony K wrote:

Re: @reboot only some lines of a script are working (yu

By Ralf Prengel at 01/10/2019 - 13:52

ok
a good hint.
I will test it monday.

Ralf

Von meinem iPhone gesendet

Re: @reboot only some lines of a script are working (yu

By Ralf Prengel at 01/14/2019 - 05:11

Found this after using debug-level.
Seems as if curl doesn t use the proxy configuration.
We are using port 8080.

}
}
2019-01-14 09:57:06,919 attempt 1/10:
<a href="http://mirrorlist.centos.org/?release=7&amp;arch=x86_64&amp;repo=os&amp;infra=stock" title="http://mirrorlist.centos.org/?release=7&amp;arch=x86_64&amp;repo=os&amp;infra=stock">http://mirrorlist.centos.org/?release=7&amp;arch=x86_64&amp;repo=os&amp;infra=stock</a>
2019-01-14 09:57:35,048 exception: [Errno 14] curl#7 - "Failed connect
to mirrorlist.centos.org:80; Die Operation ist jetzt in Bearbeitung"
2019-01-14 09:57:35,049 retrycode (14) not in list [-1, 2, 4, 5, 6,
7], re-raising
~

Zitat von Ralf Prengel <ralf. ... at rprengel dot de>: