From: Eugene Prokopiev <prokopiev@stc.donpac.ru>
To: ALT Linux Community <community@lists.altlinux.org>
Subject: Re: [Comm] Использование start-stop-daemon
Date: Mon, 06 Nov 2006 19:50:29 +0300
Message-ID: <454F67D5.9020101@stc.donpac.ru> (raw)
In-Reply-To: <20061106150041.GA6598@basalt.office.altlinux.org>
> Рекомендую использовать функции start_daemon/stop_daemon.
> См. тж.
> http://lists.altlinux.org/pipermail/devel/2006-November/038198.html
Спасибо. Сейчас имею:
# cat /usr/bin/devman
#!/bin/sh
sleep 1000000
# cat /etc/init.d/devman
#!/bin/sh
#
# /etc/init.d/devman
#
# Startup script for devman
#
# chkconfig: - 85 15
# description: Device Manager
# processname: devman
#
WITHOUT_RC_COMPAT=1
# Source function library.
. /etc/init.d/functions
PIDFILE=/var/run/devman.pid
LOCKFILE=/var/lock/subsys/devman
USER=devman
RETVAL=0
start()
{
start_daemon --lockfile "$LOCKFILE" --make-pidfile --pidfile
"$PIDFILE" --set-user "$USER" -- devman
RETVAL=$?
return $RETVAL
}
stop()
{
stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE"
--expect-user root --displayname devman su
RETVAL=$?
return $RETVAL
}
restart()
{
stop
start
}
# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condstop)
if [ -e "$LOCKFILE" ]; then
stop
fi
;;
condrestart)
if [ -e "$LOCKFILE" ]; then
restart
fi
;;
condreload)
if [ -e "$LOCKFILE" ]; then
reload
fi
;;
status)
status --pidfile "$PIDFILE" --expect-user root
--displayname devman su
RETVAL=$?
;;
*)
msg_usage "${0##*/}
{start|stop|reload|restart|condstop|condrestart|condreload|status}"
RETVAL=1
esac
exit $RETVAL
Работает это так:
[root@devman ~]# ps aux | grep devman
root 9651 0.0 0.4 1584 468 pts/0 S+ 22:47 0:00 grep devman
[root@devman ~]# service devman start
Starting devman service:
[ DONE ]
[root@devman ~]# ps aux | grep devman
root 9662 1.5 1.0 2000 964 ? Ss 22:47 0:00 /bin/su
-s /bin/sh -l devman -c /usr/bin/devman
devman 9664 1.0 0.9 2064 852 ? S 22:47 0:00 /bin/sh
/usr/bin/devman
devman 9678 0.0 0.3 1408 372 ? S 22:47 0:00 sleep
1000000
root 9680 0.0 0.4 1580 464 pts/0 S+ 22:47 0:00 grep devman
[root@devman ~]# service devman stop
Stopping devman service:
[ DONE ]
[root@devman ~]# ps aux | grep devman
devman 9678 0.0 0.3 1408 372 ? S 22:47 0:00 sleep
1000000
root 9706 0.0 0.4 1584 468 pts/0 S+ 22:47 0:00 grep devman
Почему процесс sleep не останавливается?
--
С уважением, Прокопьев Евгений
next prev parent reply other threads:[~2006-11-06 16:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-11-06 10:56 Eugene Prokopiev
2006-11-06 11:24 ` Eugene Prokopiev
2006-11-06 13:41 ` Eugene Prokopiev
2006-11-06 15:00 ` Dmitry V. Levin
2006-11-06 16:50 ` Eugene Prokopiev [this message]
2006-11-06 20:17 ` Eugene Prokopiev
2006-11-06 20:54 ` Dmitry V. Levin
2006-11-06 21:10 ` Eugene Prokopiev
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=454F67D5.9020101@stc.donpac.ru \
--to=prokopiev@stc.donpac.ru \
--cc=community@lists.altlinux.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
ALT Linux Community general discussions
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://lore.altlinux.org/community/0 community/git/0.git
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V2 community community/ http://lore.altlinux.org/community \
mandrake-russian@linuxteam.iplabs.ru community@lists.altlinux.org community@lists.altlinux.ru community@lists.altlinux.com
public-inbox-index community
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://lore.altlinux.org/org.altlinux.lists.community
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git