Re: Adding postgres user in %post

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



FYI.....the following worked.  Thanks very much for the assistance!!!

%post
chvt 3

#start postgresql now, add postgres user called Adam, and stop postgresql
/etc/rc.d/init.d/postgresql start
su - postgres -c "createuser adam -d -a"
/etc/rc.d/init.d/postgresql stop

#Make sure postgresql is started in runlevel 3
/sbin/chkconfig --level 3 postgresql on

chvt 1






liefting@xxxxxxxxxx@redhat.com on 05/21/2001 08:07:28 AM

Please respond to kickstart-list@xxxxxxxxxx

Sent by:  kickstart-list-admin@xxxxxxxxxx


To:   kickstart-list@xxxxxxxxxx
cc:

Subject:  Re: Adding postgres user in %post




>Hello All,

>I am trying to add a postgres user in the %post section of my kickstart
>file for RedHat 7.0.  In my %post section I set postgresql to start and
>stop in the 3rd run level then I try to add a postgres user called adam.

Start and stop in the third runlevel???

In a certain runlevel, applications can be started or stopped, but not both
simultaneously.

>When I do a kickstart, no postgres user gets added.  If I set that one
line
>up in a script and run the script from a prompt a postgres user does get
>added.  Do I need to reboot between starting/stopping postgresql and
adding
>the user?  I believe postgresql creates the user called postgres which I
am
>trying to use in my last command.  How come my reboot command doesn't seem
>to do anything?

The %post section is executed at the end of the installation, before the
system reboots. You can't reboot the system halfway through the %post
section and expect that the rest of the %post section is executed after the
reboot.

If you want to execute something after the reboot, you should add it to
rc.local or something, and script it so that it removes itself after
exectution.

>Any thoughts on how to get this to work would be greatly appreciated!!
>Thanks!
>Rebecca

I haven't done this myself, but what I would try is:

%post
chvt 3

#start postgresql now, add postgres user called Adam, and stop postgresql
/etc/rc.d/init.d/postgresql start
su - postgres -c "createuser adam -d -a"
/etc/rc.d/init.d/postgresql stop

#Make sure postgresql is started in runlevel 3
/sbin/chkconfig --level 3 postgresql on

chvt 1

Note: postgresql might require additional services to be available, so it
might not be possible to run postgresql this way from within the %post
section.

Another solution might be (again, not tested):

%post
chvt 3

/sbin/chkconfig --level 3 postgresql on

cat >> /etc/rc.d/rc.local << END
if [ -x /etc/rc.d/rc.postgresqlsetup ]
then
  . /etc/rc.d/rc.postgresqlsetup
  rm -f /etc/rc.d/rc.postgresqlsetup
fi
END

cat > /etc/rc.d/rc.postgresqlsetup << END
su - postgres -c "createuser adam -d -a"
END

chvt 1

Regards, Wouter.

_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/kickstart-list





_______________________________________________
Kickstart-list mailing list
Kickstart-list@xxxxxxxxxx
https://listman.redhat.com/mailman/listinfo/kickstart-list









[Index of Archives]     [Red Hat General]     [CentOS Users]     [Fedora Users]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux