ALT Linux Sisyphus discussions
 help / color / mirror / Atom feed
From: Yuriy Kashirin <yura@emict.com>
To: ALT Linux Sisyphus discussion list <sisyphus@lists.altlinux.org>
Subject: Re: [sisyphus] start process if there no it's copy
Date: Mon, 16 Jan 2006 16:17:22 +0200
Message-ID: <200601161617.23141.yura@emict.com> (raw)
In-Reply-To: <20060116134209.GC13504@ricom.ru>

On Monday 16 January 2006 15:42, Alexey Morsov wrote:
> Привет,
>
> нужно пускать юзерскую копию ivman (ну скорее всего при старте
> иксов, т.е. в ~/.xession.d/ivman я прописал
>
> #!/bin/sh
>
> IVMAN=`which ivman`
>
> id=`pgrep -U morsov ivman`
  ^^
здесь id будет содержать pid юзерского процесса, если он запущен или 
будет пустой (а не содержать "0" как вы далее видимо предполагаете)

> #id=`ps -U morsov -u morsov u|grep ivman|grep -v sh|grep -v grep|wc
> -l` 
>
> echo $id
>
> if [ '$id' -eq '0' ]

Исправьте условие на: 
if [ -z "$id" ]
Обратите внимание на то, что кавычки двойные, а не одинарные.

> then
>     echo "No usermode ivman, starting"
>     $IVMAN
> else
>     echo "Allready started"
> fi
>
> Но поскольку с башем не силен то что -то явно не так работает. Т.е.
> пока я это пускаю просто ручкми все работает как должно, а когда
> оно при старте иксов запускается, то user-copy ivman не стартует.
>
> Что я не так в скрипте намучил?

Но я бы делал по другому:
- id=`pgrep -U morsov ivman`
- if [ '$id' -eq '0' ]
+ if pgrep -U morsov ivman

(pgrep вернет ошибку если указанных процессов не найдет)

-- 
 Best regards
 Yuriy Kashirin
 
 eMICT company
 Kyiv, Ukraine
 
 phone: (+38044) 206 7800
 fax:   (+38044) 206 7801
 http://www.eMICT.com

  parent reply	other threads:[~2006-01-16 14:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-16 13:42 Alexey Morsov
2006-01-16 14:02 ` Nick S. Grechukh
2006-01-16 14:55   ` Yuriy Kashirin
2006-01-16 14:17 ` Yuriy Kashirin [this message]
2006-01-17  9:46   ` Alexey Morsov
2006-01-17  7:26 ` Epiphanov Sergei

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=200601161617.23141.yura@emict.com \
    --to=yura@emict.com \
    --cc=sisyphus@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 Sisyphus discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror http://lore.altlinux.org/sisyphus/0 sisyphus/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 sisyphus sisyphus/ http://lore.altlinux.org/sisyphus \
		sisyphus@altlinux.ru sisyphus@altlinux.org sisyphus@lists.altlinux.org sisyphus@lists.altlinux.ru sisyphus@lists.altlinux.com sisyphus@linuxteam.iplabs.ru sisyphus@list.linux-os.ru
	public-inbox-index sisyphus

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://lore.altlinux.org/org.altlinux.lists.sisyphus


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git