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

   Á¶È¸ 2717   Ãßõ 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 829/5685
2015-12   1497620   ¹é¸Þ°¡
2014-05   4961072   Á¤ÀºÁØ1
2019-12   2717   ¾È±Ô¹Î
2021-01   2717   ±×¸ðµµ
2019-05   2717   Smile
2020-01   2717   ºó°æÀ±
2018-12   2717   ±è¿µ±â
2019-06   2717   2CPUI±è¼¼ÈÆ
2020-06   2717   ¾Æ½ÎÁ¶Äí³ª
2023-02   2717   ºñ´©±Í½Å
2020-04   2717   ¿©ÁÖ³ó¹Î76
2020-12   2717   ³ª´Â°õÀε­
2020-12   2717   ¹èȸ
2023-04   2717   Çõ±º
2019-03   2717   twopaik
2018-12   2717   ¹«¾Æ
2020-05   2717   chis
2019-04   2717   ¹é¼ö°¡²Þ
2021-03   2717   ¹Ù´Ù´Á´ë
2021-06   2718   È­Á¤Å¥»ï
2019-12   2718   MidasCustom¡¦
2019-06   2718   ·çºñ¾Æºü