skotthof
2015-Jun-02 09:06 UTC
[CentOS] daemon in /etc/init.d/functions creates no pifile?
Hi, we started using centos7 to run kvm+libvirt. For novnc to virtual machines I like to start websockify as a daemon by libvirt (as a hook) Under Debian I used the line: # start-stop-daemon --start --chuid $RUNUSER --make-pidfile --pidfile $PIDFILE --startas $PROGRAM -- $OPTIONS which creates a nice pidfile. In Centos I figured out, to include /etc/init.d/functions and I tried: # daemon --user $RUNUSER --pidfile=$PIDFILE $PROGRAM $OPTIONS But this seems not to create a pidfile at all. It checks only if a pidile exist already. This is executed at the end # $cgroup $nice runuser -s /bin/bash $user -c "$corelimit >/dev/null 2>&1 ; $*" Am I missed something? Thanks, Sebastian -- Sebastian Kotthoff Rechenzentrum Universit?t Mannheim B6, 23-29; Building B; Room 1.10 68159 Mannheim Tel: +49 621 181 2516 Fax: +49 621 181 2682
skotthof
2015-Jun-02 12:42 UTC
[CentOS] daemon in /etc/init.d/functions creates no pifile?
OK, I figured out, I have to install redhat-lsb package for start-stop-daemon "Implementation of Linux Standard Base specification" Thanks, Sebastian On Tue, Jun 02, 2015 at 11:06:59AM +0200, skotthof wrote:> Hi, > > we started using centos7 to run kvm+libvirt. > For novnc to virtual machines I like to start > websockify as a daemon by libvirt (as a hook) > > Under Debian I used the line: > # start-stop-daemon --start --chuid $RUNUSER --make-pidfile --pidfile $PIDFILE --startas $PROGRAM -- $OPTIONS > which creates a nice pidfile. > > In Centos I figured out, to include /etc/init.d/functions and I tried: > # daemon --user $RUNUSER --pidfile=$PIDFILE $PROGRAM $OPTIONS > > But this seems not to create a pidfile at all. It checks only if > a pidile exist already. > This is executed at the end > # $cgroup $nice runuser -s /bin/bash $user -c "$corelimit >/dev/null 2>&1 ; $*" > > Am I missed something? > > Thanks, > > Sebastian > -- > Sebastian Kotthoff > Rechenzentrum > Universit?t Mannheim > B6, 23-29; Building B; Room 1.10 > 68159 Mannheim > > Tel: +49 621 181 2516 > Fax: +49 621 181 2682> _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos-- Sebastian Kotthoff Rechenzentrum Universit?t Mannheim B6, 23-29; Building B; Room 1.10 68159 Mannheim Tel: +49 621 181 2516 Fax: +49 621 181 2682
skotthof
2015-Jun-02 14:27 UTC
[CentOS] daemon in /etc/init.d/functions creates no pifile?
using systemd unit templates seems to be even a better idea, I'm using that now. Let systemd handle that stuff is more easy. # cat /etc/libvirt/hooks/qemu --------------- #!/bin/bash DOMAIN=$1 ACTION=$2 RUNUSER="websockify" case "$ACTION" in "start" ) exec systemctl start websockify@$DOMAIN.service;; "stopped" ) exec systemctl stop websockify@$DOMAIN.service;; esac --------------- # cat /etc/systemd/system/websockify\@.service [Unit] Description=Start Websockify + novnc for %i [Service] #User=websockify ExecStart=/etc/libvirt/hooks/start_websockify.sh %i On Tue, Jun 02, 2015 at 11:06:59AM +0200, skotthof wrote:> Hi, > > we started using centos7 to run kvm+libvirt. > For novnc to virtual machines I like to start > websockify as a daemon by libvirt (as a hook) > > Under Debian I used the line: > # start-stop-daemon --start --chuid $RUNUSER --make-pidfile --pidfile $PIDFILE --startas $PROGRAM -- $OPTIONS > which creates a nice pidfile. > > In Centos I figured out, to include /etc/init.d/functions and I tried: > # daemon --user $RUNUSER --pidfile=$PIDFILE $PROGRAM $OPTIONS > > But this seems not to create a pidfile at all. It checks only if > a pidile exist already. > This is executed at the end > # $cgroup $nice runuser -s /bin/bash $user -c "$corelimit >/dev/null 2>&1 ; $*" > > Am I missed something? > > Thanks, > > Sebastian > -- > Sebastian Kotthoff > Rechenzentrum > Universit?t Mannheim > B6, 23-29; Building B; Room 1.10 > 68159 Mannheim > > Tel: +49 621 181 2516 > Fax: +49 621 181 2682> _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos-- Sebastian Kotthoff Rechenzentrum Universit?t Mannheim B6, 23-29; Building B; Room 1.10 68159 Mannheim Tel: +49 621 181 2516 Fax: +49 621 181 2682
m.roth at 5-cent.us
2015-Jun-02 14:51 UTC
[CentOS] daemon in /etc/init.d/functions creates no pifile?
skotthof wrote:> > OK, I figured out, I have to install > redhat-lsb package for start-stop-daemon > "Implementation of Linux Standard Base specification" > > Sebastian > On Tue, Jun 02, 2015 at 11:06:59AM +0200, skotthof wrote: >> Hi, >> >> we started using centos7 to run kvm+libvirt. >> For novnc to virtual machines I like to start >> websockify as a daemon by libvirt (as a hook) >> >> Under Debian I used the line: >> # start-stop-daemon --start --chuid $RUNUSER --make-pidfile --pidfile >> $PIDFILE --startas $PROGRAM -- $OPTIONS >> which creates a nice pidfile. >> >> In Centos I figured out, to include /etc/init.d/functions and I tried: >> # daemon --user $RUNUSER --pidfile=$PIDFILE $PROGRAM $OPTIONS<snip> Sorry I missed the beginning of this thread. You are using (CentOS 6) service blablah start, or (CentOS 7) systemctl start blahblah, yes? mark