Re: [Vserver] How to use init script

From: Xavier Montagutelli <xavier.montagutelli_at_unilim.fr>
Date: Mon 12 Jun 2006 - 08:33:09 BST
Message-Id: <200606120933.09898.xavier.montagutelli@unilim.fr>

On Monday 12 June 2006 06:33, HongDan wrote:
> I want to execute some tasks when a vserver is started, but I don't know
> how to make it. I found an instruction in
> http://www.solucorp.qc.ca/howto.hc?projet=vserver&id=56
> But it seems that it doesn't work for util-vserver 0.30.210. Are there any
> other ways to do it?
>
> Bruno gave me a hint that I can change util-vserver to call a script in
> /usr/lib/utils-vserver/vserver.start. I found these commands in it:
>
> pushd "$VSERVER_DIR"/vdir/ >/dev/null
> execScriptlets "$VSERVER_DIR" "$VSERVER_NAME" post-start
> popd >/dev/null
>
> So I tried touching a file "post-start" in /etc/vservers/<guestname>/, and
> put my initscript in "post-start". But it doesn't work either. Am I on a
> right way?

Try to put your script in the "scripts" sub-directory.

From the flower page
http://www.nongnu.org/util-vserver/doc/conf/configuration.html :

/etc/vservers/vserver-name/scripts
 
A directory for scripts. By default, when one of these scripts will be
executed, the execution of defaultscripts (within .../.defaults/scripts) will
be skipped. To execute them nevertheless, the $DONT_SKIP_DEFAULTS environment
variable must be set by one of the in-shellcontext scripts (the
non-executable ones).

post-start :
The scriptlet which will be executed after the vserver has been started.
Before executing the script, the vserver root directory will be made the
working directory.

>
> There's an associated problem with sshd. I edited guest's sshd_config file
> to listen on a designated ipv6 address, which is binded to guest with
> Daniel's chbind6 only after the guest's started. But sshd could not start
> up automatically because there's no ipv6 address assigned yet when guest is
> starting up. So I hope the guest starts up with this sequence:
> 1. guest started up
> 2. Using chbind6 to assign an ipv6 address for it
> 3. Start up sshd
> I think I could cancel the automatically start of sshd, and put "chbind6"
> and "service sshd start" into vserver's initscripts. Are there any other
> good ideas?
>
> ----------------------------Snip----------------------------------------
> #vserver gast start
> Starting system logger: [ OK ]
> Starting kernel logger: [ OK ]
> Starting sshd: [ OK ]
> Starting xinetd: [ OK ]
> Starting crond: [ OK ]
>
> #vserver gast enter
> [root@th024045 /]# service sshd status
> sshd dead but subsys locked
>
> #vserver gast stop
> Stopping sshd: [FAILED]
> Stopping xinetd: [ OK ]
> Stopping crond: [ OK ]
> Shutting down kernel logger: [FAILED]
> Shutting down system logger: [ OK ]
> Starting killall: Stopping sshd: [FAILED]
> [FAILED]
> -------------------------snap---------------------------------------
>
>
> Best regards!
>
> _______________________________________________
> Vserver mailing list
> Vserver@list.linux-vserver.org
> http://list.linux-vserver.org/mailman/listinfo/vserver

-- 
Xavier Montagutelli                      Tel : +33 (0)5 55 45 77 20
Service Commun Informatique              Fax : +33 (0)5 55 45 75 95
Universite de Limoges
123, avenue Albert Thomas
87060 Limoges cedex
_______________________________________________
Vserver mailing list
Vserver@list.linux-vserver.org
http://list.linux-vserver.org/mailman/listinfo/vserver
Received on Mon Jun 12 08:34:09 2006
[Next/Previous Months] [Main vserver Project Homepage] [Howto Subscribe/Unsubscribe] [Paul Sladen's vserver stuff]
Generated on Mon 12 Jun 2006 - 08:34:15 BST by hypermail 2.1.8