ALT Linux Community general discussions
 help / color / mirror / Atom feed
From: Vladimir Karpinsky <vkarpinsky@mail.ru>
To: community@lists.altlinux.org
Subject: Re: [Comm] NUT и Ippon
Date: Sun, 22 Jan 2012 20:12:59 +0400
Message-ID: <4F1C358B.6060707@mail.ru> (raw)
In-Reply-To: <20120121160711.GC6411@atlas.home>

21.01.2012 20:07, Sergey Vlasov пишет:
> Отключение через заданное время после пропадания внешнего питания
> можно настроить через upssched;

Решил попробовать настроить отключение slave компьютера через upssched? и 
не получилось. При вытыкании ИБП из розетки получаю в /var/log/messages 
следующее:

Jan 22 18:23:24 pullet upsmon[17744]: UPS ippon@192.168.5.2 on battery
Jan 22 18:23:24 pullet upsmon[28478]: UPS ippon@192.168.5.2 on battery
Jan 22 18:23:24 pullet upsmon[21055]: UPS ippon@192.168.5.2 on battery
Jan 22 18:23:24 pullet wall[27438]: wall: user upsmon broadcasted 1 lines 
(34 chars)
Jan 22 18:23:31 pullet upssched[27440]: Failed to connect to parent and 
failed to create parent: No such file or directory

Во-первых, 3 раза про то, что UPS ушёл на батареи, а самое главное --- 
последняя строка: кто такой этот parent я не понимаю. При возврате что-то 
отрабатывает, сообщения от upsmon тоже тройкой проходят:

Jan 22 18:28:14 pullet upsmon[17744]: UPS ippon@192.168.5.2 on line power
Jan 22 18:28:14 pullet upsmon[28478]: UPS ippon@192.168.5.2 on line power
Jan 22 18:28:14 pullet upsmon[21055]: UPS ippon@192.168.5.2 on line power
Jan 22 18:28:14 pullet wall[26650]: wall: user upsmon broadcasted 1 lines 
(37 chars)
Jan 22 18:28:14 pullet upssched[26652]: Executing command: ups-back-on-line
Jan 22 18:28:14 pullet upssched[26652]: exec_cmd(/usr/sbin/upssched-cmd 
ups-back-on-line) returned 126

В /etc/nut/upsmon.conf:

MONITOR ippon@192.168.5.2 1 monuser pass slave
SHUTDOWNCMD "/sbin/shutdown -h +0"
NOTIFYCMD /usr/sbin/upssched
NOTIFYFLAG ONLINE  SYSLOG+WALL+EXEC
NOTIFYFLAG ONBATT  SYSLOG+WALL+EXEC
NOTIFYFLAG LOWBATT SYSLOG+WALL+EXEC

$ ls -l
-rwxr-xr-x 1 root root 19896 Apr 13  2007 /usr/sbin/upssched

В /etc/nut/upssched.conf

CMDSCRIPT /usr/sbin/upssched-cmd
PIPEFN /var/run/upssched/upssched.pipe
LOCKFN /var/run/upssched/upssched.lock
AT ONBATT * START-TIMER onbattwarn 30 # Seconds!
AT ONLINE * CANCEL-TIMER onbattwarn
AT ONBATT * START-TIMER  earlyshutdown 180 # Seconds!
AT ONLINE * CANCEL-TIMER earlyshutdown
AT ONLINE * EXECUTE ups-back-on-line

Каталог /var/run/upssched существует
$ ls -l  /usr/sbin/ups*
-rwxr-xr-x 1 root root 47140 Apr 13  2007 /usr/sbin/upsd
-rwxr-xr-x 1 root root 43500 Apr 13  2007 /usr/sbin/upsmon
-rwxr-xr-x 1 root root 19896 Apr 13  2007 /usr/sbin/upssched
-rwx------ 1 root root   504 Jan 22 18:23 /usr/sbin/upssched-cmd

$ cat /usr/sbin/upssched-cmd
#!/bin/sh
mail="user@address"
case $1 in
       onbattwarn)
       echo "The UPS has been on battery for a while" | /bin/mail -s "UPS 
monitor" "$mail"
       ;;
       ups-back-on-power)
       echo "Power restored" | /bin/mail -s "UPS monitor" "$mail"
       ;;
       earlyshutdown)
       logger -t upssched-cmd "UPS on battery too long, forced shutdown!"
       echo "UPS forced shutdown" | /bin/mail -s "UPS monitor" "$mail"
       /sbin/shutdown -h now
       ;;
       *)
       /usr/bin/logger -t upssched-cmd "ERROR!! Unrecognized command: $1"
       ;;
esac

Письма тоже не приходят. Может, кроме рута, на выполнение этого скрипта 
надо ещё кому-нибудь права дать?

-- 
	С уважением,
		Владимир.


  parent reply	other threads:[~2012-01-22 16:12 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-20 14:00 Vladimir Karpinsky
2012-01-20 14:07 ` Vladimir Karpinsky
2012-01-21 12:35   ` Sergey Vlasov
2012-01-21 13:05     ` Vladimir Karpinsky
2012-01-21 16:07       ` Sergey Vlasov
2012-01-21 18:29         ` Dubrovskiy Viacheslav
2012-01-21 18:47           ` Vladimir Karpinsky
2012-01-21 18:38         ` Vladimir Karpinsky
2012-01-22 17:18           ` Michael Shigorin
2012-01-22 17:28             ` Vladimir Karpinsky
2012-01-22 17:51               ` Michael Shigorin
2012-01-22 17:59                 ` Vladimir Karpinsky
2012-01-22 21:04                 ` Yura Kalinichenko
2012-01-22 16:12         ` Vladimir Karpinsky [this message]
2012-01-22 17:12           ` Yura Kalinichenko
2012-01-22 17:23             ` Vladimir Karpinsky
2012-01-24 14:19             ` Vladimir Karpinsky
2012-01-24 14:37               ` Шенцев Алексей Владимирович
2012-01-24 14:51                 ` Vladimir Karpinsky
2012-01-24 15:00                   ` Шенцев Алексей Владимирович
2012-01-24 15:21                     ` Vladimir Karpinsky
2012-01-24 15:31                       ` Шенцев Алексей Владимирович
2012-01-24 15:39                         ` Vladimir Karpinsky
2012-01-24 15:51                           ` Шенцев Алексей Владимирович
2012-01-24 16:01                             ` Vladimir Karpinsky
2012-01-24 19:48                           ` Sergey Vlasov
2012-01-25 15:50                             ` Vladimir Karpinsky
2012-01-25 20:50                               ` Alexey Borisenkov
2012-01-26  5:27                                 ` Vladimir Karpinsky
2012-01-24 19:04                       ` Andrey Liakhovets
2012-01-24 19:13                         ` Vladimir Karpinsky
2012-02-01 13:18                           ` Vladimir Karpinsky
2012-02-01 16:17                             ` Vladimir Karpinsky
2012-02-02 15:24                               ` Vladimir Karpinsky
2012-02-01 17:01                             ` Andrey Liakhovets
2012-02-01 17:32                               ` Vladimir Karpinsky
2012-02-01 18:06                                 ` Andrey Liakhovets
2012-02-01 18:11                                   ` Vladimir Karpinsky
2012-01-22 17:37           ` Dubrovskiy Viacheslav
2012-01-21 12:23 ` Sergey Vlasov

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=4F1C358B.6060707@mail.ru \
    --to=vkarpinsky@mail.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