copy an existing XML manifest file as a basis for your new service exc04-sv02d:/ # cp /lib/svc/manifest/network/http-apache22.xml /jails/etc/httpd22-primary-chroot.xml I've just cleaned it up a little - nothing too serious, but i've updated the 'boot' script referenced in the .xml file like so .. the "exec_method"'s are the important bits where you configure start/stop/restart and I removed all the property stuff, that would allow you to choose 64bit apache and/or a couple of other options - have a look at the original for more info #---------------------------------------------------------------------- #---------------------------------------------------------------------- exc04-sv02d:/jails/etc # cat /jails/etc/httpd22-primary-chroot #!/sbin/sh CHROOT_DIR=/jails/web-jail CHROOT_CMD=/usr/sbin/chroot # TEMPORARY!!! CHROOT_DIR="" CHROOT_CMD="" exec $CHROOT_CMD $CHROOT_DIR /web/server/etc/httpd22-primary $* #---------------------------------------------------------------------- exc04-sv02d:/jails/etc # cat /web/server/etc/httpd22-primary #!/bin/sh # # $Header: /web/server/etc/RCS/httpd22-primary,v 1.1 2012/05/08 00:38:04 mwd Exp mwd $ # # Production WWW Server Startup/Shutdown script # # set -x # CHROOT="/usr/sbin/chroot /jail/web" CHROOT= HTTPD_BASE=/web/server/httpd22 HTTPD_CONF=$HTTPD_BASE/conf/main-primary.conf HTTPD_CONF=$HTTPD_BASE/conf/httpd.conf PERL58=/web/server/perl589/bin/perl USAGE="$0 [start|stop|restart|configtest|perltest]" PERL58MODULES=" ModPerl::Registry DBI Mysql Stat::lsMode Net::DNS Net::SNMP Crypt::CBC Crypt::Blowfish WAT::AdminDBURI WAT::AuthLDAP WAT::AuthzDBURI WAT::AuthzLDAP WAT::Breadcrumb WAT::CookieHome WAT::Filter WAT::Index WAT::HeaderDeny WAT::Lib WAT::ModifyFilter " ulimit -n -S 2048 ulimit -n -H 4096 ulimit -s 16384 . /etc/TIMEZONE export TZ CMASK LC_COLLATE LC_CTYPE LC_MESSAGES LC_MONETARY LC_NUMERIC LC_TIME case $1 in start) /bin/echo " httpd22 production \c" $CHROOT $HTTPD_BASE/bin/httpd -k start -f $HTTPD_CONF ;; stop) /bin/echo " stopping httpd22 production \c" $CHROOT $HTTPD_BASE/bin/httpd -k stop -f $HTTPD_CONF ;; restart) $CHROOT $HTTPD_BASE/bin/httpd -e Info -k restart -f $HTTPD_CONF ;; configtest|test) $CHROOT $PERL58 -MWAT::Filter -e 'print "WAT::Filter installed, testing httpd22 config\n"' && $CHROOT $HTTPD_BASE/bin/httpd -t -f $HTTPD_CONF ;; perltest) $CHROOT $PERL58 -v && for i in $PERL58MODULES do export i $CHROOT $PERL58 -M$i -e 'print "$ENV{'i'}\n"' || exit 2 done && /bin/echo && /bin/echo All required perl modules and dependants installed ;; *) /bin/echo $USAGE >&2; exit 1 ;; esac exit 0 #---------------------------------------------------------------------- exc04-sv02d:/jails/etc # svccfg import /jails/etc/httpd22-primary-chroot.xml exc04-sv02d:/jails/etc # svcs -a |fgrep http disabled Mar_30 svc:/network/http:apache22 disabled 11:20:19 svc:/network/http:httpd22-primary-chroot exc04-sv02d:/jails/etc # svcadm enable svc:/network/http:httpd22-primary-chroot exc04-sv02d:/jails/etc # svcs -a |fgrep http disabled Mar_30 svc:/network/http:apache22 online 11:21:21 svc:/network/http:httpd22-primary-chroot #---------------------------------------------------------------------- ps. it's not actually chrooted, not yet, and this isn't tested but it's pretty much a copy of what i did on exc01-sp-p
Various snippets of UNIX code that might just be a waste if I keep them to myself. This blog is very much a work in progress and is mainly for myself. Yes, I should probably host code on one of those fancy code hosting web sites and I probably will eventually.
Tuesday, April 15, 2014
Solaris: creating a service
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment