This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

UPS support missing...

Okay,
first of all i'm a newbie, and the wonderful product called "ASL" [;)].
But...
...why there isn't UPS support in webadmin???

now, i'm thinking to a quick solution and i would know if is possible:
can we make a script (send by ssh) by a remote win machine that will login as root and "say" > before shutting down with its managed ups?
obviusly asl is connect at ups.
Win machine will lunch the script before shutting down thx to the ups manager software (in my case).

tia

Mario

ps: sorry for all grammatical errors, i'm italian and i don't speak english well... [:$]
pps: if is possible can you teach to me how to do this script?


This thread was automatically locked due to age.
Parents
  • ups support is not built into asl at all....
  • [ QUOTE ]
    ups support is not built into asl at all.... 

    [/ QUOTE ]

    okay,
    the way to bypass this problem (IMHO) is to have a machine (win, linux doesn't matter) with support for ups. when the batteries of ups goes low the machine will shutdown, but before shutdown it lunch a script (many ups monitorage software allow to run application or batch before shutting down). 
    This script must only login as root and say "shutdown -h now".
    The asl machine is also connecte to another ups (there are ups that give powewr until their batteries are empty) but we shutdown this machine before the batterie goes empty thx to the script.

    any suggestion??

    Mario
  • Look into using the "expect" language.. one of the guys at my work uses it a lot for working with Cisco routers...

    Here is a simple perl script, unable to test it right now as I dont want to shutdown my production firewall.. try it out if you can/want to...

    #!/usr/bin/perl -w
    use Expect;

    $expect_delay=120;
    $system_pass = "thisisthepassword";

    $login=Expect->spawn("ssh -l loginuser node.domain.com") or die "Can't start SSH: $! \n";
    $login->clear_accum();
    $match = $login->expect($expect_delay,"Password:");
    print $login "$system_pass\r";

    $login->clear_accum();
    $match = $login->expect($expect_delay,'$');
    print $login "shutdown -h now\r";

    END
  • You shouldn't need to use a script like that (not that it wouldn't work).

    You can tell most SSH clients to run a single command on login.
    # ssh
    Usage: ssh [options] host [command]

    Nonetheless, you probably don't need to worry too much about killing the power on ASL... it uses EXT3 which is resistant to filesystem corruption from things like that.
Reply
  • You shouldn't need to use a script like that (not that it wouldn't work).

    You can tell most SSH clients to run a single command on login.
    # ssh
    Usage: ssh [options] host [command]

    Nonetheless, you probably don't need to worry too much about killing the power on ASL... it uses EXT3 which is resistant to filesystem corruption from things like that.
Children
  • [ QUOTE ]
    You shouldn't need to use a script like that (not that it wouldn't work).

    You can tell most SSH clients to run a single command on login.
    # ssh
    Usage: ssh [options] host [command]

    Nonetheless, you probably don't need to worry too much about killing the power on ASL... it uses EXT3 which is resistant to filesystem corruption from things like that. 

    [/ QUOTE ]

    ok, thx a lot, this seem easier.
    but under M$ os how can i lunch this script??
    currently i'm using putty, do you know others clients that support scripts??
  • The simple solution is to just connect your Astaro box to a big UPS (I use an APC Smart-UPS 1400) and forget about it.

    Astaro is a router and firewall, not a file server, so shutting down the disk system before the power disappears is not that critical.
  • SecureCRT comes with a command-line program called vsh

    syntax is similar to openssh

    I'd imagine Putty has a command-line program as well.

    On windows, you'd need a UPS daemon that can run a windows command. I don't know of any offhand, but I don't use any so I wouldn't be one to ask.

    Barry
  • [ QUOTE ]
    SecureCRT comes with a command-line program called vsh

    syntax is similar to openssh

    I'd imagine Putty has a command-line program as well.

    On windows, you'd need a UPS daemon that can run a windows command. I don't know of any offhand, but I don't use any so I wouldn't be one to ask.

    Barry 

    [/ QUOTE ]

    you immage well!
    putty had "plink"  as command-line program but i can't create a script to automatically say:
    "su -" and the password.....
    any suggest??

    TIA

    mario
  •  [ QUOTE ]
      putty had "plink" as command-line program but i can't create a script to automatically say:
    "su -" and the password.....
    any suggest??

    [/ QUOTE ] 
    Sorry, forgot you have to SU to shutdown.

    Try setting the SUID bit on the shutdown executable, or create a SUID script that does it, that way you won't have to store the password anywhere.

    Or see if you can use SUDO if you're worried about using SUID (you shouldn't worry about it as you shouldn't be allowing any untrusted users to login on ASL).

    Barry
  • ok men!
    i need to keep asl on because my damned isp (god frag him!) has set a "timeout" of 2 hrs when my dialup line goes down without disconnecting [:$], so if my "energy system" (sorry, i don't know how to translate it) goes down and adsl modem and router shutdown without disconnect from adsl i must wait for 2 hrs even if i can recover my "energy system"  in 5 min....so i want to use an ups for my modem and asl.

    i'll try other suggested clients...

    TIA

    Mario
  • [ QUOTE ]
     [ QUOTE ]
      putty had "plink" as command-line program but i can't create a script to automatically say:
    "su -" and the password.....
    any suggest??

    [/ QUOTE ] 
    Sorry, forgot you have to SU to shutdown.

    Try setting the SUID bit on the shutdown executable, or create a SUID script that does it, that way you won't have to store the password anywhere.

    Or see if you can use SUDO if you're worried about using SUID (you shouldn't worry about it as you shouldn't be allowing any untrusted users to login on ASL).

    Barry 

    [/ QUOTE ]

    ok barry,
    but....'m really a newbye and linux is pratically a taboo for me, and 'd you please say to me what i need to type in my shell (is called so, right?) to use SUID (i understand that is a way to do something to user that can do only admnis) in my asl box??

    TIA

    Mario
  • login and SU to root

    run
    chmod u+s /sbin/shutdown
    to set shutdown to be SUID

    then test it.
    logout, & log in as loginuser, and run 
    shutdown -k now

    and it should say shutting down, and then "shutdown canceled"
    (-k is test only, don't really shutdown)

    Barry
  • [ QUOTE ]
    login and SU to root

    run
    chmod u+s /sbin/shutdown
    to set shutdown to be SUID

    then test it.
    logout, & log in as loginuser, and run 
    shutdown -k now

    and it should say shutting down, and then "shutdown canceled"
    (-k is test only, don't really shutdown)

    Barry 

    [/ QUOTE ]

    thx barry, but it doesn't works, i do everything you say but when i login as loginuser and type shutdown -k now i get this result:

    -bash: shutdown: command not found

    why???

    TIA

    Mario
  • loginuser maybe doesn't have the permission to do this.
    su - is needed, I guess.