Todd Benivegna
2020-Aug-04 14:43 UTC
[Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
Right, but I don't know what NUT script is actually calling it. I don't know how else I would check. On Tue, Aug 4, 2020 at 10:21 AM Manuel Wolfshant <wolfy at nobugconsulting.ro> wrote:> On 8/4/20 4:16 PM, Todd Benivegna wrote: > > Ok, so now that I think of it, that might not actually work when it is > > not run by me. I guess that it all confirms that it works in Bash, > > but I think when it runs on its own it would use Dash... > > it uses whatever shell you ask for in the first line of the script > > > > > > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at alioth-lists.debian.net > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser-- *Todd Benivegna* // todd at benivegna.com -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20200804/f81a84bc/attachment.html>
Manuel Wolfshant
2020-Aug-04 15:00 UTC
[Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
On 8/4/20 5:43 PM, Todd Benivegna wrote:> Right, but I don't know what NUT script is actually calling it. I > don't know how else I would check. >you could - use SHUTDOWNCMD ="|echo $SHELL > /tmp/WhatShellIsInUse" and check the content of that file after a shutdown is triggered | |- proceed as you suggested earlier and add the same function in dash's initialization file| |- place all the commands suggested by Roger ( including the function itself ) in a standard script saved on disk ( as a file ) and invoke that script from the shutdown command| | | ||> On Tue, Aug 4, 2020 at 10:21 AM Manuel Wolfshant > <wolfy at nobugconsulting.ro <mailto:wolfy at nobugconsulting.ro>> wrote: > > On 8/4/20 4:16 PM, Todd Benivegna wrote: > > Ok, so now that I think of it, that might not actually work when > it is > > not run by me. I guess that it all confirms that it works in Bash, > > but I think when it runs on its own it would use Dash... > > it uses whatever shell you ask for in the first line of the script > > > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20200804/7bc57268/attachment-0001.html>
Roger Price
2020-Aug-04 18:38 UTC
[Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
On Tue, 4 Aug 2020, Todd Benivegna wrote:> Right, but I don't know what NUT script is actually calling it. I don't know how else I would check.Sorry. I've lost the thread here, what is the "it" you refer to? If you run the command grep nut /etc/password you will probably receive a reply similar to nut:x:121:126::/var/lib/nut:/bin/false The /bin/false implies that user nut uses the default shell which can be seen on a Debian box with the command ls -alF /bin/sh lrwxrwxrwx 1 root root 4 Jan 24 2017 /bin/sh -> dash* This says that Dash is the default for the command line and for scripts. As Manuel has said this can be changed with the first line of a script, e.g. #!/bin/bash says that this script uses Bash. Roger
Todd Benivegna
2020-Aug-05 00:44 UTC
[Nut-upsuser] Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
> Sorry. I've lost the thread here, what is the "it" you refer to?I’m not an linux expert so you’ll have to bear with me, but I guess the it I was referring to whatever NUT is using since what we’re editing is a config file, not a script; it doesn’t have a shebang at the top.> If you run the command > > grep nut /etc/passwordI got: grep: /etc/password: No such file or directory> can be seen on > a Debian box with the command > > ls -alF /bin/shI got: lrwxrwxrwx 1 root root 4 Apr 23 11:02 /bin/sh -> dash* Also I did "echo $SHELL" in a terminal window and got "/bin/bash”. So what I found earlier is true; Bash is used in the Terminal app and Dash is used for scripts. So anyway, I guess that means that it is using Dash then, correct? Ok, so I copied the getUPSstatus function in .profile as well. So it has been added to both .bashrc and .profile and I have added... SHUTDOWNCMD "getUPSstatus ups at 192.168.1.70 ; logger -t upsmon.conf \"UPS status is $UPSstatus\" ; /sbin/shutdown -h +0" …to my upsmon.conf. So I think I should be go to go for the next time this happens; should get some more information as to what is going on. Also, I was thinking about your suggestion, Manuel, to use Wireshark as well. You mentioned,> My first suspect is the Synology version of nut. More specifically, I suspect that nut triggers a shutdown immediately after the switch to "on battery" state and only cancels it after a restart.That may seem to be the case, however, whenever I test by manually pulling the power, the servers stay up and all appears normal. It has happened three times now where I am away and the power goes out for 3-5 seconds and the servers shutdown and will stay down, even if I try to power back on, until I restart the Synology NAS. Thanks for both your guys’ help with everything so far…. I really appreciate it. Todd -- Todd Benivegna // todd at benivegna.com On Aug 4, 2020, 2:38 PM -0400, Roger Price <roger at rogerprice.org>, wrote:> On Tue, 4 Aug 2020, Todd Benivegna wrote: > > > Right, but I don't know what NUT script is actually calling it. I don't know how else I would check. > > Sorry. I've lost the thread here, what is the "it" you refer to? > > If you run the command > > grep nut /etc/password > > you will probably receive a reply similar to > > nut:x:121:126::/var/lib/nut:/bin/false > > The /bin/false implies that user nut uses the default shell which can be seen on > a Debian box with the command > > ls -alF /bin/sh > lrwxrwxrwx 1 root root 4 Jan 24 2017 /bin/sh -> dash* > > This says that Dash is the default for the command line and for scripts. As > Manuel has said this can be changed with the first line of a script, e.g. > > #!/bin/bash > > says that this script uses Bash. > > Roger > _______________________________________________ > Nut-upsuser mailing list > Nut-upsuser at alioth-lists.debian.net > https://alioth-lists.debian.net/cgi-bin/mailman/listinfo/nut-upsuser-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://alioth-lists.debian.net/pipermail/nut-upsuser/attachments/20200804/216c8d32/attachment.html>
Possibly Parallel Threads
- Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
- Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
- Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
- Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)
- Synology NAS is shutting down Ubuntu servers after very brief power outage (fwd)