Re: init.d startup script

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

 



Al Sparks wrote:
This is a small thing, but it's bothering me.

I've got a startup script placed in /etc/init.d that starts up Xvfb for
me.  I basically used the /etc/init.d/sendmail startup as a template.

   start() {
# Start daemons.
          echo -n $"Starting $prog: "
          daemon Xvfb :1 -screen 0 6x6x8 -fp /usr/lib/X11/fonts/misc &
          RETVAL=0
          echo
          return $RETVAL
  }

When I run # service Xvfb start

I get "Starting Xvfb" w/o the "[ OK  ]" at the end of the line.  But
Xvfb does start up.

Also, when I do a # ps -Ao "%u %p %P %a" | grep Xvfb
  root      1528     1 /bin/bash /etc/init.d/Xvfb start
  root      1529  1528 initlog -q -c Xvfb :1 -screen 0 6x6x8 -fp /usr/lib/X11/fonts/misc
  root      1530  1529 Xvfb :1 -screen 0 6x6x8 -fp /usr/lib/X11/fonts/misc

Now when I run the same startup without the "daemon" in front of the
program name, I get
  # ps -Ao "%u %p %P %a" | grep Xvfb
  root      1583     1 Xvfb :1 -screen 0 6x6x8 -fp /usr/lib/X11/fonts/misc

which seems more reasonable.


Since I can get the script to startup what I want to start up, it's not
a big deal.  I'm only doing this for aesthetics.  But still...

The "daemon" function is intended to be used with programs that put themselves in the background, and doesn't work so well if you have to do it yourself wuth "&".

I had a similar problem with the initscripts for bittorrent (seed and tracker programs) in Fedora Extras. What I ended up with was along the lines of:

  echo -n $"Starting BitTorrent seed client: "
  /sbin/runuser -s /bin/sh -c "$prog $OPTS" $USER >> $LOG 2>&1 &
  disown -ar
  usleep 500000
  status btseed &> /dev/null && echo_success || echo_failure
  RETVAL=$?
  [ $RETVAL -eq 0 ] && touch /var/lock/subsys/btseed
  echo

Something similar might work for you.

Paul.


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux