Errors in script which runs on boot

I have made an installer script of my architecture which runs on boot, and I added it to chkconfig:

#!/bin/bash
#
# chkconfig: 2345 99 30
# description: Product Installer Service
# 
if [ -f /home/installer.sh ]; then 
    sleep 60 
    bash /home/installer.sh > /root/.productlog 2>/root/.productlog 
    rm -f /home/installer.sh 
fi

When I run installer.sh manually it works perfectly, but on boot it gives a lot of errors:

cp: cannot stat 'default/etc/named.conf': No such file or directory
.
cp: cannot stat 'default/var/www/html/index.php': No such file or directory
.
chown: invalid user: 'apache:apache'
cp: cannot stat '/var/lib/mysql': No such file or directory
chown: invalid user: 'mysql:mysql'
/home/installer.sh: line 787: mysql: command not found
.
.

Is there any way to fix this? Could I perhaps use an @reboot cron job to run it after boot has completed?

Answer

Attribution
Source : Link , Question Author : Niahm , Answer Author : Community

Leave a Comment