Hi.

I'd also take into account how you plan to configure Subversion. When
I'm not needing Apache2 and mod_svn I usually configure it as an inetd
service. I blogged about it, you can start here:

http://thegreyblog.blogspot.com/search/label/subversion

Hope this helps,
Enrico

On Tue, Oct 6, 2009 at 10:23 PM, Trevor Pretty
<trevor_pre...@eagle.co.nz> wrote:
>
> If it does not come with a manifest for SMF you need to write one. If it
> does then use it! or just use an rc script. However using the rc scrpt ans
> making a service run under SMF is not hard. Attached is what I wrote as a
> demo before postgress got an SMF service by default.
>
> Look at "demo 2" in the self running ksh script where I demo my newly
> created service.
>
> The Defiant wrote:
>
> Hi All,
>
> Another newbie question. I've just configured a seprate contaniner to serve
> as a seprate svn repository and configured svnserve as the default svn
> server. Everything works fine, except svnserve wont autostart after
> rebooting ;(
>
> Can someone point me to adding svnserve to autostart. I guess we would be
> using SMF service and not the autostart.sh
>
> Thx in advance!
>
>
>
>
> www.eagle.co.nz
>
> This email is confidential and may be legally privileged. If received in
> error please destroy and immediately notify us.
> #!/usr/bin/ksh
> #
> #
> #Note: The presentation is:-
> #
> #http://webhome.singapore/trevor/Standard_Pressos/Solaris10_Demos/Sol10_demo_Overview/Solaris10_demo_SMF_CONTAINERS_ZFS.odp
> #
> #
> #
> # NOTE: This one use apache22 the older version use apache2
> #
> #http://webhome.singapore/trevor/Standard_Pressos/Solaris10_Demos/Sol10_demo_Overview/smf_demo_self_running.ksh_apache2
> #
> #
> #--------------Setup-------------------
> #
> #get the two files you need:-
> #
> #http://webhome.singapore/trevor/Standard_Pressos/Solaris10_Demos/Sol10_demo_Overview/pgsql
> #http://webhome.singapore/trevor/Standard_Pressos/Solaris10_Demos/Sol10_demo_Overview/pgsql.xml
> #
> #copy these to (or anywhere else you prefer):
> #
> #/lib/svc/method/pgsql
> #/var/svc/manifest/application/pgsql.xml
> #
> #Setup pgsql if you have not already.
> #
> #NOTE: This may be already under SMF conrol in later NV builds you will need
> to check when
> #      I wrote this it was not under SMF control. This was what I did on S10
> many moons
> #      ago to setup postgres, it's survived many LUs
> # svcs -a | grep sql
> # disabled       11:08:53 svc:/application/database/postgresql:version_81
> # disabled       11:08:53
> svc:/application/database/postgresql_83:default_32bit
> # disabled       11:08:53
> svc:/application/database/postgresql:version_82_64bit
> # disabled       11:08:53 svc:/application/database/postgresql:version_82
> # disabled       11:08:53
> svc:/application/database/postgresql_83:default_64bit
> # disabled       11:08:54 svc:/application/database/mysql:version_50
> #
> #
> #file:///usr/share/doc/pgsql/8.1.3/html/installation.html
> #
> #su -
> #DATA=/var/lib/pgsql/data
> #mkdir $DATA                   #This should exist it is the default
> #useradd -d /home/postgres postgres
> #mkdir ~postgres
> #chown postgres ~postgres
> #chown postgres $DATA
> #
> #su - postgres
> #DATA=/var/lib/pgsql/data
> #/bin/initdb -D $DATA
> #/bin/createdb test    #Optional
> #/bin/psql -l
> #
> #su -
> #svccfg delete -f pgsql
> #cd /home/tp47565/Software/PostgreSQL
> #cp ./pgsql.xml /var/svc/manifest/application
> #cp ./pgsql /lib/svc/method
> #chmod a+r /lib/svc/method/pgsql
> #svccfg validate /var/svc/manifest/application/pgsql.xml
> #svccfg import /var/svc/manifest/application/pgsql.xml
> #svcadm enable pgsql
> #svcs pgsql
> #su - postgres -c "/bin/psql -l"
> # Note: I've setup the postgres user to run /bin/psql -l
> #       and then logout
> #*******************************************************
>
>
> ## Press return to continue (so you can talk!)
> #
> press_return()
> {
>        echo "\n\t------> Press RETURN to continue <------\c"
>        read ANS
>        echo ""
>        clear
> }
>
> ## Do the commands given appending with ----> so they show up
> #
> do_command()
> {
>        echo ""
>        echo "------> $*"
>        eval $*
> }
>
> ## I should check if you have the role but I don't - too lazy!
> #
> UID=`/usr/xpg4/bin/id -u`
> if [ ! $UID -eq 0 ]; then
>        echo "You must be root to run this script"
>        press_return
>        exit 1
> fi
>
>
> ######################################################
> ###################### DEMO START ####################
> ######################################################
>
> #--------------- demo 1 simple commands ------------------------
>
> # Have a browser Running to show that apache stops and starts
> # /home/tp47565/bin/browser.sh norton/~tp47565
>
> svcadm disable apache22 #Just in case it is turned off
> sleep 2
> svcadm enable apache22
> sleep 3
> cd /tmp
> clear
> echo ""
> echo "Is apache22 running, a simple ps to find out"
> echo ""
> echo ""
> do_command ps -ef | grep apache | grep -v grep
> echo ""
> echo "I can also see it is via the Browser"
> press_return
> echo ""
> echo " So lets send the processes a kill -9"
> echo ""
> do_command kill -9 `pgrep httpd `
> echo ""
> echo "Is apache22 running, a simple ps to find out"
> echo ""
> do_command sleep 5
> echo ""
> do_command ps -ef | grep apache | grep -v grep
> echo ""
> echo "I can also see it is via the Browser"
> echo ""
> echo "But did you Notice the PIDs have changed?"
> press_return
> echo ""
> echo ""
> echo "In Solaris 10 most things have been turned into Services"
> echo "Lets look into /etc/init.d"
> do_command ls /etc/init.d
> echo ""
> echo ""
> echo "There seems to be a lot less than I remember?"
> press_return
> echo ""
> echo ""
> echo "Lets look at sendmail"
> press_return
> do_command more /etc/init.d/sendmail
> press_return
> echo "RTFM!"
> press_return
> do_command man smf
> press_return
> do_command svcs |more
> press_return
> echo ""
> echo "lets just look at the apache22 service"
> do_command svcs apache22
> press_return
> echo ""
> echo "lets disable (turn off) apache22 service"
> echo "notice the -t it will only be disabled until the next reboot"
> do_command svcadm -v disable -t apache22
> do_command sleep 3
> do_command svcs -x apache22
> press_return
> do_command tail -10 /var/svc/log/network-http:apache22.log
> press_return
> echo ""
> echo "lets enable (turn on) apache22 service"
> do_command svcadm -v enable apache22
> press_return
> echo ""
> echo "We can find out more about the apache22 service"
> echo "What does it depend on?"
> do_command svcs -d apache22
> echo ""
> echo "Depends on autofs?"
> press_return
> echo ""
> do_command svcs -l apache22
> press_return
> echo ""
> echo "What does depend on it?"
> echo "what are the processes?"
> do_command svcs -D apache22
> do_command svcs -p apache22
> press_return
> echo ""
> echo "OK what about if it does not start?"
> echo ""
> do_command svcadm -v disable apache22
> do_command sleep 3
> do_command mv /etc/apache2/2.2/httpd.conf /etc/apache2/2.2/httpd.conf.MOVED
> do_command svcadm -v enable apache22
> press_return
> do_command svcs apache22
> do_command svcs -x apache22
> do_command tail /var/svc/log/network-http:apache22.log
> press_return
> echo ""
> echo "The SMF log was no help"
> echo ""
> do_command /usr/apache2/2.2/bin/httpd --help
> press_return
> do_command mv /etc/apache2/2.2/httpd.conf.MOVED /etc/apache2/2.2/httpd.conf
> do_command svcadm clear apache22
> do_command sleep 3
> do_command svcs apache22
> press_return
> echo ""
> echo ""
> echo ""
> echo " Back to Presentation - we need to know more..."
> press_return
>
>
>
> #--------------- demo 2 putting an app under SMF control
> ------------------------
>
> ## Clear out the log file and delete anything we may have
> #
> svcadm disable pgsql
> cp /dev/null /var/svc/log/application-pgsql:default.log
> svccfg delete -f pgsql
>
>
> ## Show I had to put in an exit 0 but basically used the /etc/init.d file
> #
> echo ""
> echo "First off we need to write the manifest"
> echo ""
> echo "I simply copied an existing one and edited it"
> press_return
> do_command more /var/svc/manifest/application/pgsql.xml
> press_return
> echo ""
> echo "I then need a script to start stop and restart"
> echo ""
> echo "I simply used the init.d script and edited it a bit"
> echo ""
> press_return
> do_command more /lib/svc/method/pgsql
> press_return
> echo ""
> echo "Validate and import"
> echo ""
> do_command svccfg validate /var/svc/manifest/application/pgsql.xml
> do_command svccfg import /var/svc/manifest/application/pgsql.xml
> press_return
> echo ""
> echo "Enable and check status"
> echo ""
> do_command svcadm enable pgsql
> do_command sleep 5
> do_command svcs -x pgsql
> press_return
> echo ""
> echo "The complete set of properties"
> echo ""
> do_command svcprop pgsql | more
> press_return
> echo ""
> echo "Test the databse is running"
> echo ""
> do_command su - postgres -c "/bin/psql -l"
> press_return
> echo ""
> echo "Disable and check it actually disables"
> echo ""
> do_command svcadm -v disable -t pgsql
> do_command sleep 5
> do_command su - postgres -c "/bin/psql -l"
> press_return
> echo ""
> echo "Enable and check the logs"
> echo ""
> do_command svcadm enable pgsql
> do_command sleep 5
> do_command svcs -x pgsql
> press_return
> do_command more /var/svc/log/application-pgsql:default.log
> press_return
> echo ""
> echo "Lets test it is bullet-proof"
> echo ""
> do_command svcs -p pgsql
> do_command kill -9 `pgrep postgres | head -1`
> do_command sleep 5
> do_command svcs -p pgsql
> echo ""
> do_command su - postgres -c "/bin/psql -l"
> press_return
> echo ""
> echo "What's in the log?"
> echo ""
> do_command tail /var/svc/log/application-pgsql:default.log
> press_return
> echo ""
> echo "And is it really running?"
> echo ""
> do_command su - postgres -c "/bin/psql -l"
> press_return
> echo ""
> echo ""
> echo "Easy!"
> echo ""
> exit 0
>
>
> #!/sbin/sh
> #
> # Note: we need the exit 0 as /bin/pg_ctl returns 1 and that
> #       stops the auto restart by SMF
>
> case $1 in
> 'start')
>        /bin/pg_ctl -D /var/lib/pgsql/data -l logfile start
>        exit 0
>        ;;
>
> 'stop')
>        /bin/pg_ctl -D /var/lib/pgsql/data -l logfile stop
>        exit 0
>        ;;
>
> 'restart')
>        /bin/pg_ctl -D /var/lib/pgsql/data -l logfile restart
>        exit 0
>        ;;
>
>
> *)
>        echo "Usage: $0 { start | stop | restart}"
>        exit 1
>        ;;
> esac
>
> _______________________________________________
> zones-discuss mailing list
> zones-discuss@opensolaris.org
>



-- 
Ελευθερία ή θάνατος
"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe trying
to produce bigger and better idiots. So far, the Universe is winning."
GPG key: 1024D/FD2229AF
_______________________________________________
zones-discuss mailing list
zones-discuss@opensolaris.org

Reply via email to