File bat per spegnimento NAS

Language plugins e scripts (Java, Node.js, Pearl, PHP, Python, Ruby, ?sh)
Rispondi
free70
Utente
Utente
Messaggi: 2
Iscritto il: mercoledì 18 marzo 2015, 20:08

File bat per spegnimento NAS

Messaggio da free70 »

Non sò se si la sezione corretta......
Mi chiedo se si possa creare un file .bat per Windows 7 affinchè cliccandoci sopra parta un comando per spegnere il nas, senza dover premere il pulsante o entrare nella nas da browser.
Avatar utente
dMajo
Moderatore
Moderatore
Messaggi: 1962
Iscritto il: sabato 18 agosto 2012, 23:14
Località: FVG - Italia

Re: File bat per spegnimento NAS

Messaggio da dMajo »

Si, puoi fare uno script che si connetta in telnet con le credenziali root e lanci il comando shutdown.
Per vedere le opzioni collegati in telnet e digita "shutdown --help"
Dal 01.01.2015 non rispondo a quesiti tecnici dei non osservanti il regolamento https://www.synologyitalia.com/presentazioni/regolamento-leggere-prima-di-postare-t5062.html

  • UPS: APC SMT2200I+AP9631
  • GTW: Vigor2866Vac(4.4.2): 2StaticIP FTTH(1/.1G)+FTTC(30/3M) :o
  • SWC: Netgear GS728TPv2(PoE+)
    • 4x HP NJ2000G
    • 2x Netgear GS108Tv2
    • 2x VigorAP902
  • NAS: DS1819+: DSM6.2.4(u7),32GB; C(2x845DCPro),R5(3xST6000VN001),R0(2xWD60PURX),VB(WD60EFRX);LAN:LAG(1+2),3,4 :D
    • DS1815+: DSM6.2.4(u7),16GB; R5(3xWD60EFRX),VB(2xWD60EFRX);LAN:LAG(1+2),3
    • RS3617xs+: DSM6.2.4(u7),8GB; R6(8xWD40FFWX),HS(WD40FFWX);LAN:LAG(1+2+3),4,LAG(5+6)
    • DS1513+(4GB); DS115j
  • ALTRO: Denon AVR-4311
    • UE55ES8000Q, UE32ES6800Q, UE22F5410AY
    • Galaxy Note8, A5, TabS3; Nokia N8
  • EXP: E5: NET9 PC:W9,M0,L6

www.alldataee.com
free70
Utente
Utente
Messaggi: 2
Iscritto il: mercoledì 18 marzo 2015, 20:08

Re: File bat per spegnimento NAS

Messaggio da free70 »

Non mi pare che ci sia il comando che cerco io però......

Codice: Seleziona tutto

DiskStation> shutdown --help
Usage: shutdown [OPTION]... TIME [MESSAGE]
Bring the system down.

Options:
  -r                          reboot after shutdown
  -h                          halt or power off after shutdown
  -H                          halt after shutdown (implies -h)
  -P                          power off after shutdown (implies -h)
  -c                          cancel a running shutdown
  -k                          only send warnings, don't shutdown
  -q, --quiet                 reduce output to errors only
  -v, --verbose               increase output to include informational messages
      --help                  display this help and exit
      --version               output version information and exit

TIME may have different formats, the most common is simply the word 'now' which
will bring the system down immediately.  Other valid formats are +m, where m is
the number of minutes to wait until shutting down and hh:mm which specifies the
time on the 24hr clock.

Logged in users are warned by a message sent to their terminal, you may include
an optional MESSAGE included with this.  Messages can be sent without actually
bringing the system down by using the -k option.

If TIME is given, the command will remain in the foreground until the shutdown
occurs.  It can be cancelled by Control-C, or by another user using the -c
option.

The system is brought down into maintenance (single-user) mode by default, you
can change this with either the -r or -h option which specify a reboot or
system halt respectively.  The -h option can be further modified with -H or -P
to specify whether to halt the system, or to power it off afterwards.  The
default is left up to the shutdown scripts.

Report bugs to <upstart-devel@lists.ubuntu.com>
DiskStation>
Pensavo che fosse piu semplice creare un file Bat e lanciarlo dal desktop di windows.......ma mi pare che non sia cosi semplice.....
Avatar utente
dMajo
Moderatore
Moderatore
Messaggi: 1962
Iscritto il: sabato 18 agosto 2012, 23:14
Località: FVG - Italia

Re: File bat per spegnimento NAS

Messaggio da dMajo »

Sul nas puoi usaer anche il commando "poweroff" che alla fine richiama "shutdown".

Al di la di questo sul pc può bastare anche un .bat, ma solo per pilotare qualcosa tipo putty (da riga di commando).
E' molto più elegante se lo fai in vbs o powershell. Così non ti serve nessun ulteriore software installato sul pc.

Un qualcosa di simile (non testato):

Codice: Seleziona tutto

<script language="VBScript">
Option Explicit
On Error Resume Next
Dim WshShell
set WshShell=CreateObject("WScript.Shell")
WshShell.run "cmd.exe"
WScript.Sleep 1000
WshShell.SendKeys "telnet 192.168.1.1"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WshShell.SendKeys "root"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 250
WshShell.SendKeys "lapassdiadmin"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 250
WshShell.SendKeys "poweroff -p"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 250
WshShell.SendKeys "exit"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 500
WshShell.SendKeys "exit"
WshShell.SendKeys ("{Enter}")
WScript.Sleep 1000
WScript.Quit 
</script>
ma puoi trovare veramente montagne di roba con una semplice googlata
Dal 01.01.2015 non rispondo a quesiti tecnici dei non osservanti il regolamento https://www.synologyitalia.com/presentazioni/regolamento-leggere-prima-di-postare-t5062.html

  • UPS: APC SMT2200I+AP9631
  • GTW: Vigor2866Vac(4.4.2): 2StaticIP FTTH(1/.1G)+FTTC(30/3M) :o
  • SWC: Netgear GS728TPv2(PoE+)
    • 4x HP NJ2000G
    • 2x Netgear GS108Tv2
    • 2x VigorAP902
  • NAS: DS1819+: DSM6.2.4(u7),32GB; C(2x845DCPro),R5(3xST6000VN001),R0(2xWD60PURX),VB(WD60EFRX);LAN:LAG(1+2),3,4 :D
    • DS1815+: DSM6.2.4(u7),16GB; R5(3xWD60EFRX),VB(2xWD60EFRX);LAN:LAG(1+2),3
    • RS3617xs+: DSM6.2.4(u7),8GB; R6(8xWD40FFWX),HS(WD40FFWX);LAN:LAG(1+2+3),4,LAG(5+6)
    • DS1513+(4GB); DS115j
  • ALTRO: Denon AVR-4311
    • UE55ES8000Q, UE32ES6800Q, UE22F5410AY
    • Galaxy Note8, A5, TabS3; Nokia N8
  • EXP: E5: NET9 PC:W9,M0,L6

www.alldataee.com
Rispondi

Torna a “Language plugins e scripts (Java, Node.js, Pearl, PHP, Python, Ruby, ?sh)”