Dear All I have been working on a custom ISO with kickstart and a couple of post installation scripts and would like to have the script run before the login prompt. The custom ISO works; however, the scripts fails because some of the services, e.g. mariadb does not start before the server installation has been completed and rebooted; therefore, I have been putting the scripts in /etc/profile.d/ and after logging in the scripts will execute and upon completion of the script will be deleted from /etc/profile.d/. DuckDuckGo suggested that I copy the script to /etc/rc.d/rc.local and make it executable; however, I have tried that a few times and the script simply does not execute. Below is an excerpt from the ks.cfg. export SRCDIR="/run/install/repo" export DSTDIR="/mnt/sysimage" # copy scripts to the destintion of the server cp -v $SRCDIR/postinstall/script1.sh $DSTDIR/etc/rc.d/rc.local/script1.sh # Make scripts executable chmod +x $DSTDIR/etc/rc.d/rc.local.sh Since this is a ISO for a community project, don't think that tools such as Ansible, Chef, Puppet, etc. will work here. Also, it is a one time execution; therefore, I did not consider using systemd because the goal would be to have visibility while the script is running just as I see after I login; however, just need the script to be executed after the OS was installed and restarted and before the login prompt. All suggestions are welcome. Thanks in advance. -- Earl Ramirez <earlaramirez at gmail.com> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: <http://lists.centos.org/pipermail/centos/attachments/20180609/02c8fdc8/attachment-0001.sig>
On 09.06.2018 14:48, Earl Ramirez wrote:> # copy scripts to the destintion of the server > cp -v $SRCDIR/postinstall/script1.sh > $DSTDIR/etc/rc.d/rc.local/script1.share you sure about this line? rc.local must be a file, not a directory. best regards Ulf
On Sat, 2018-06-09 at 15:10 +0200, Ulf Volmer wrote:> On 09.06.2018 14:48, Earl Ramirez wrote: > > > # copy scripts to the destintion of the server > > cp -v $SRCDIR/postinstall/script1.sh > > > $DSTDIR/etc/rc.d/rc.local/script1.sh > > are you sure about this line? rc.local must be a file, not a > directory. > > best regards > UlfThanks Ulf That was a typo on the email cp -v $SRCDIR/postinstall/snipeit.sh $DSTDIR/etc/rc.d/rc.local # Make scripts executable chmod +x $DSTDIR/etc/rc.d/rc.local -- Earl Ramirez <earlaramirez at gmail.com> -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 833 bytes Desc: This is a digitally signed message part URL: <http://lists.centos.org/pipermail/centos/attachments/20180609/9f9b5449/attachment-0001.sig>
If your distro is using systemd then rc.local will not get executed by default. Enable rc-local.service : "systemctl enable rc-local.service". Regards, Prasad On 9 June 2018 at 18:18, Earl Ramirez <earlaramirez at gmail.com> wrote:> Dear All > > I have been working on a custom ISO with kickstart and a couple of post > installation scripts and would like to have the script run before the > login prompt. > > The custom ISO works; however, the scripts fails because some of the > services, e.g. mariadb does not start before the server installation > has been completed and rebooted; therefore, I have been putting the > scripts in /etc/profile.d/ and after logging in the scripts will > execute and upon completion of the script will be deleted from > /etc/profile.d/. > > DuckDuckGo suggested that I copy the script to /etc/rc.d/rc.local and > make it executable; however, I have tried that a few times and the > script simply does not execute. > > Below is an excerpt from the ks.cfg. > > > export SRCDIR="/run/install/repo" > export DSTDIR="/mnt/sysimage" > > # copy scripts to the destintion of the server > cp -v $SRCDIR/postinstall/script1.sh > $DSTDIR/etc/rc.d/rc.local/script1.sh > > # Make scripts executable > chmod +x $DSTDIR/etc/rc.d/rc.local.sh > > Since this is a ISO for a community project, don't think that tools > such as Ansible, Chef, Puppet, etc. will work here. > > Also, it is a one time execution; therefore, I did not consider using > systemd because the goal would be to have visibility while the script > is running just as I see after I login; however, just need the script > to be executed after the OS was installed and restarted and before the > login prompt. > > All suggestions are welcome. > > Thanks in advance. > -- > Earl Ramirez <earlaramirez at gmail.com> > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos > >
On 11 June 2018 at 01:57, Prasad K <email.kprasad at gmail.com> wrote:> If your distro is using systemd then rc.local will not get executed by > default. > Enable rc-local.service : "systemctl enable rc-local.service". > >Thanks, Prasad I tried that and unfortunately, that service did not start after the server was rebooted; therefore the script was not called by systemd-rc-local-generator. Will continue to investigate and report back -- Kind Regards Earl Ramirez