½Ã³î·ÎÁö Rsync ¹é¾÷Á¾·áÈÄ ¿ø°ÝÁ¾·á Remote Shutdown ½ºÅ©¸³Æ®¸¦ ¸¸µé°í ½Í½À´Ï´Ù.

   Á¶È¸ 2752   Ãßõ 0    

 열심히 구글링을 해봤는데, 쉽게 답이 찾아지질 않네요.

.sh 스크립트로 하나 만들어서

이 안에서 Rsync 백업 명령 1줄 (Source -> Target)

이 작업 끝나면, 

백업 헤놀인 Target을 Remote Shutdown을 보내는 명령 1줄

이면 될 것 같습니다만,

방법이 없을까요?

image
ªÀº±Û Àϼö·Ï ½ÅÁßÇÏ°Ô.
±èÁ¦¿¬ 2021-06
±×³É ÇÑÁÙ ³ÖÀ¸½Ã¸é µÇÁö ¾ÊÀ»±î¿ä ..
ssh target.mycorp.net sudo shutdown -h now
ÀÌ·±½ÄÀ¸·Î ÇÏ¸é µÉ°Í °°½À´Ï´Ù.
ssh -t -p password root@192.168.1.1 -p 32022 "poweroff"
ÀÌ·¸°Ô ÇÏ¸é µÈ´Ù°í ±¸±Û¸µÇؼ­ ã±äÇß½À´Ï´Ù.^^
https://kbase.io/shutdown-or-reboot-a-synology-nas-remotely-using-ssh/
±×·±µ¥ Àú ¾ÏÈ£¿¡ !°¡ À־ÀÎÁö ¸ø¾Ë¾Æ¸Ô°í ƨ±â³×¿ä. ¾ÏÈ£¸¦ ´Ù½Ã Á¤ÇÏ°í ³»ÀÏ Çѹø´õ ½ÃÇèÇØ º¸°Ú½À´Ï´Ù.
´äº¯ °¨»çÇÕ´Ï´Ù.
     
dateno1 2021-06
Æнº¿öµå Ư¹® ¹®Á¦·Î SSHµîÀÌ °ÅºÎ ´çÇϴ°æ¿ì escape ó¸®Çغ¸¼¼¿ä

ÀÌ¿Ü¿¡ ÆÄÀÏ¿¡ ºñ¹øÀ» ÀûÀºÈÄ ÀÌ°É ÀаÔÇÏ´Â ¹æ¹ýµµ ÀÖ½À´Ï´Ù
          
ÀÏ´Ü ¿©·¯°¡Áö °øºÎÁßÀε¥, ¸Æ Å͹̳ο¡¼­ ½Ã³î·ÎÁö¿¡ ¾ÏÈ£¾øÀÌ ssh pub key ÆÄÀϺ¹»çÇؼ­ Á¢¼ÓÇÏ´Â°Í ºÎÅÍ Çغ¸°í ÀÖ½À´Ï´Ù.
2½Ã°£ »ðÁú³¡¿¡ ¼º°øÇ߳׿ä.^^
°¥±æÀÌ ¸Ö±º¿ä...¤¾¤¾
               
dateno1 2021-06
Å°¸¦ ±âÁØÀ¸·Î Çصµ µÇ°í, ¾ÏÈ£¸¦ ÆÄÀÏ·Î ÀúÀåÇؼ­ ±×°É ÀаÔÇصµ µÉ²®´Ï´Ù

´Ù¸¸ ¸Æ ±âº»À¸·Î µÇ´ÂÁö´Â Àß ¸ð¸£°Ú½À´Ï´Ù
À§¿¡ ¾Ë·ÁÁֽŠÆÁµé È°¿ëÇؼ­ ÃÖÁ¾¼º°øÇؼ­ ¹æ¹ý °øÀ¯ÇÕ´Ï´Ù.
NAS 1(¸ÞÀÎ) -> NAS 2(¹é¾÷)  »çÀÌ¿¡ admin °èÁ¤³¢¸® ssh ·Î±×ÀÎÇÒ ¶§ ssh-keygen À» »ç¿ëÇؼ­ .ssh µð·ºÅ丮 pub key »ý¼º ¹× º¹»ç¸¦ ÁøÇàÇß½À´Ï´Ù.
ÀÌ·¸°ÔµÇ¸é admin°èÁ¤»çÀÌ¿¡ passwordless loginÀÌ °¡´ÉÇØ Áý´Ï´Ù.

±×¸®°í, NAS 2 ¿¡ ´Ù½Ã passwordless sudo loginÀ» °¡´ÉÇÏ°Ô Çϱâ À§Çؼ­ ¾Æ·¡ Ä¿¸Çµå·Î sudoers ÆÄÀÏ¿¡ ¾Æ·¡ ¶óÀÎÀ» Ãß°¡Ã³¸® ÇÕ´Ï´Ù.
echo -e "\n$USER ALL=(ALL) NOPASSWD: ALL\n" | sudo tee -a /etc/sudoers
Àß ¼³Á¤µÇ¾î ÀÖ´ÂÁö È®ÀÎÇÏ·Á¸é ¾Æ·¡Ã³·³ È®ÀÎÇÕ´Ï´Ù.
sudo -l
< ¾Æ·¡°á°ú Ãß°¡µÊ È®ÀÎ >
    (ALL) NOPASSWD: ALL
-------------------------------------
NAS 1(¸ÞÀÎ) -> NAS 2(¹é¾÷)  passwordless login È®ÀÎ
NAS 2(¹é¾÷) admin -> sudo passwordless login È®ÀÎ
--------------------------------------
NAS 1 (¸ÞÀÎ) ÂÊ¿¡¼­ ¾Æ·¡ Ä¿¸Çµå°¡ ÀÌÁ¦ ¸ÔÈü´Ï´Ù.
ssh -p 32022 admin@192.168.x.y sudo "poweroff"

ÀÌÁ¦ ½ºÄÉÁì·¯¿¡ Àú Ä¿¸Çµå¸¦ Ãß°¡Çؼ­ ½ÃÇèÇغ¸°í Á¶±Ý¸¸ ´õ ¼Õº¸¸é µÉ°Í °°½À´Ï´Ù.
ÀÌ ±âȸ¿¡ passwordless ·Î±×ÀÎ °øºÎ¸¦ ¸¹ÀÌ ÇϰԵǼ­ À¯ÀÍÇß½À´Ï´Ù.
µµ¿òÁֽŠµÎºÐ Á¤¸» °¨»çµå¸³´Ï´Ù.^^
     
°­Á¶õ¿¡ ¾ÏÈ£¾øÀÌ ·Î±×ÀÎ ¼³Á¤ÇÏ´Â ¹æ¹ýÀ» ¿ä¾àÁ¤¸® Çß½À´Ï´Ù.

http://www.2cpu.co.kr/lec/3990


QnA
Á¦¸ñPage 717/5688
2015-12   1535823   ¹é¸Þ°¡
2014-05   4999960   Á¤ÀºÁØ1
2020-03   2535   ¹ÚÁ¾´ë
2021-07   2535   ioilover
2022-12   2535   cho609495
2022-04   2535   ¹¹µçÆȾƿä
2020-02   2535   º´¸ÀÆù
2020-04   2535   ses497
2022-09   2535   ¸Ó¶óÄ«´Âµ¥
2019-07   2535   ³Ä¹Ì³Ä¹Ì
2019-05   2535   ¹Ù¶÷°õµ¹
2021-07   2535   epowergate
2022-01   2535   Smile
2021-02   2535   Cheshire
2021-02   2535   yollman
2020-09   2535   °³¹é¼ö28È£
2021-04   2536   ºí¶ó
2020-03   2536   ¸®´ª¼­
2022-02   2536   ±îÄ¡»ê°³²ÜÅÊ
2020-01   2536   ²¿±ââ
2019-03   2536   GyuJiiiiiill
2023-04   2536   ºñ¿À´Â³¯¿ì»ê