start daemon with rc.d
Hello misc. In old release of OBSD to start daemons with system was used rc.local. For example: if [ -x /usr/local/bin/mysqld_safe ] ; then su -c _mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &' echo -n ' mysql' fi In 5.0 have changes described here: http://www.openbsd.org/faq/faq10.html#rc and in man rc.d and rc.conf.local. The questions is how to start mysqld_safe or cupsd or any other daemon, that was placed in /etc/rc.d? Add the lines to rc.conf.local like this: pkg_scripts="cupsd" pkg_scripts="mysqld" or something else?
Re: start daemon with rc.d
On Wed, Dec 21, 2011 at 02:26:32PM +0400, pavel pocheptsov wrote: > Hello misc. > In old release of OBSD to start daemons with system was used rc.local. > For example: > if [ -x /usr/local/bin/mysqld_safe ] ; then >su -c _mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &' >echo -n ' mysql' > fi > > In 5.0 have changes described here: http://www.openbsd.org/faq/faq10.html#rc > and in man rc.d and rc.conf.local. > The questions is how to start mysqld_safe or cupsd or any other daemon, > that was placed in /etc/rc.d? > Add the lines to rc.conf.local like this: > pkg_scripts="cupsd" > pkg_scripts="mysqld" > > or something else? pkg_scripts="cupsd mysqld" Order matters, since daemons will be started accordingly. -- Antoine
Re: start daemon with rc.d
On Wed, Dec 21, 2011 at 03:17:24PM +0400, pavel pocheptsov wrote: > 21 P4P5P:P0P1QQ 2011, 14:41 P>Q Antoine Jacoutot : > > On Wed, Dec 21, 2011 at 02:26:32PM +0400, pavel pocheptsov wrote: > > > Hello misc. > > > In old release of OBSD to start daemons with system was used rc.local. > > > For example: > > > if [ -x /usr/local/bin/mysqld_safe ] ; then > > >su -c _mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &' > > >echo -n ' mysql' > > > fi > > > > > > In 5.0 have changes described here: http://www.openbsd.org/faq/faq10.html#rc > > > and in man rc.d and rc.conf.local. > > > The questions is how to start mysqld_safe or cupsd or any other daemon, > > > that was placed in /etc/rc.d? > > > Add the lines to rc.conf.local like this: > > > pkg_scripts="cupsd" > > > pkg_scripts="mysqld" > > > > > > or something else? > > > > pkg_scripts="cupsd mysqld" > > > > Order matters, since daemons will be started accordingly. > > > > -- > > Antoine > > > > > Thanks, so old way is no longer needed or it use for daemons, > that not properly installed and not put own startup-script in /etc/rc.d? You can still use the old way if you prefer. -- Antoine
Re: start daemon with rc.d
On Wed, Dec 21, 2011 at 12:27 PM, Antoine Jacoutot wrote: > On Wed, Dec 21, 2011 at 03:17:24PM +0400, pavel pocheptsov wrote: >> 21 P4P5P:P0P1QQ B 2011, 14:41 P>Q B Antoine Jacoutot : >> > On Wed, Dec 21, 2011 at 02:26:32PM +0400, pavel pocheptsov wrote: >> > > Hello misc. >> > > In old release of OBSD to start daemons with system was used rc.local. >> > > For example: >> > > if [ -x /usr/local/bin/mysqld_safe ] ; then >> > > B B su -c _mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &' >> > > B B echo -n ' mysql' >> > > B fi >> > > >> > > In 5.0 have changes described here: > http://www.openbsd.org/faq/faq10.html#rc >> > > and in man rc.d and rc.conf.local. >> > > The questions is how to start mysqld_safe or cupsd or any other daemon, >> > > that was placed in /etc/rc.d? >> > > Add the lines to rc.conf.local like this: >> > > pkg_scripts="cupsd" >> > > pkg_scripts="mysqld" >> > > >> > > or something else? >> > >> > pkg_scripts="cupsd mysqld" >> > >> > Order matters, since daemons will be started accordingly. >> > >> > -- >> > Antoine >> > >> > >> Thanks, so old way is no longer needed or it use for daemons, >> that not properly installed and not put own startup-script in /etc/rc.d? > > You can still use the old way if you prefer. > > > -- > Antoine > Let me also squeeze in a couple of words into the topic. :) I'm very glad that OpenBSD has at last moved to the rc.d model, I like this approach much better. I had been using it all the way before, but before rc.d appeared here officially I'd been (and - sorry - keep on) doing it like this: vi /etc/rc.local echo 'starting local daemons:' ### SERVICES_LIST=`/bin/ls /etc/rc.d/*sh` for sh in ${SERVICES_LIST}; do ${sh} start done ### echo "---" vi /etc/rc.shutdown SERVICES_LIST=`/bin/ls /etc/rc.d/*sh` for sh in ${SERVICES_LIST}; do ${sh} stop done mkdir -p /etc/rc.d/rc.5 cd /etc/rc.d/rc.5 vi D000mysql.sh #!/bin/sh ### MYDIR="/usr/local/mysql" LEDIR="/usr/local/mysql/libexec" PIDIR="/usr/local/mysql/data" USER="mysql" ### case $1 in start) if [ -x ${MYDIR}/bin/mysqld_safe -a -x ${LEDIR}/mysqld ]; then /bin/sleep 1 (cd ${MYDIR}; ./bin/mysqld_safe --user=${USER} --federated --ndbcluster >/dev/null 2>&1 &); echo " MySQL is up! " /bin/sleep 1 fi ;; stop) (${MYDIR}/bin/mysqladmin -u shutdown -pshutdown_user_pwd shutdown); echo " MySQL shut down! " /bin/sleep 1 ;; hup) $0 stop /bin/sleep 4 /bin/rm ${PIDIR}/*.err /bin/sleep 1 $0 start ;; ### *) echo "Usage: `basename $0` {start|stop|hup}" >&2 exit 64 ;; esac exit 0 ### chmod 555 D000mysql.sh ln -s /etc/rc.d/rc.5/D000mysql.sh /etc/rc.d/D000mysql.sh and so on with squid, apache, etc... Any time you need to turn off a daemon from the auto start just remove the link from /etc/rc.d or rename it without .sh P.S. No, I'm not a linuxoid at all, I'd say - an esthete... :) -- ### Coonardoo - PQP8P=P8QP:P0 Q QQP=Q / The Well In The Shadow / Le Puits Dans L'Ombre ###
Re: start daemon with rc.d
On Wednesday 21 December 2011 12:26:32 pavel pocheptsov wrote: > Hello misc. > In old release of OBSD to start daemons with system was used rc.local. > For example: > if [ -x /usr/local/bin/mysqld_safe ] ; then >su -c _mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &' >echo -n ' mysql' > fi > > In 5.0 have changes described here: > http://www.openbsd.org/faq/faq10.html#rc and in man rc.d and rc.conf.local. > The questions is how to start mysqld_safe or cupsd or any other daemon, > that was placed in /etc/rc.d? > Add the lines to rc.conf.local like this: > pkg_scripts="cupsd" > pkg_scripts="mysqld" > > or something else? I'd like to point out that the latter line will overwrite what was inside $pkg_scripts varible before that, so your example would only start mysqld. You need to use the format that Antoine gave or include the previous value of the variable when assigning: pkg_scripts="$pkg_scripts cupsd" # not really necessary on the first item pkg_scripts="$pkg_scripts mysqld" -- Antti Harri
Re[2]: start daemon with rc.d
21 P4P5P:P0P1QQ 2011, 14:41 P>Q Antoine Jacoutot : > On Wed, Dec 21, 2011 at 02:26:32PM +0400, pavel pocheptsov wrote: > > Hello misc. > > In old release of OBSD to start daemons with system was used rc.local. > > For example: > > if [ -x /usr/local/bin/mysqld_safe ] ; then > >su -c _mysql root -c '/usr/local/bin/mysqld_safe >/dev/null 2>&1 &' > >echo -n ' mysql' > > fi > > > > In 5.0 have changes described here: http://www.openbsd.org/faq/faq10.html#rc > > and in man rc.d and rc.conf.local. > > The questions is how to start mysqld_safe or cupsd or any other daemon, > > that was placed in /etc/rc.d? > > Add the lines to rc.conf.local like this: > > pkg_scripts="cupsd" > > pkg_scripts="mysqld" > > > > or something else? > > pkg_scripts="cupsd mysqld" > > Order matters, since daemons will be started accordingly. > > -- > Antoine > > Thanks, so old way is no longer needed or it use for daemons, that not properly installed and not put own startup-script in /etc/rc.d?