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

   Á¶È¸ 2700   Ãßõ 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 4858/5682
2014-05   4952576   Á¤ÀºÁØ1
2015-12   1489117   ¹é¸Þ°¡
2020-01   2700   Espial
2019-03   2700   ¹Ù´Ù´Á´ë
2018-12   2700   chotws
2020-06   2700   ¾Æ½ÎÁ¶Äí³ª
2019-08   2700   ±è°Ç¿ì
2019-07   2700   ³Ä¹Ì³Ä¹Ì
2022-10   2700   º¸¶ó¸Å
2023-02   2700   µö¸¶Àεå
2020-11   2700   ÆÄÇÇǪÆä
2020-12   2700   ¹é¸¸½º¹°Çϳª
2023-08   2700   IÀû¿ì
2019-03   2700   Won³«¿¬
2019-05   2699   È­¶õ
2019-05   2699   ÇູÇϼ¼
2020-08   2699   ¾ËÄÉÀ̸Ó
2020-02   2699   Yune
2019-10   2699   ±èÁ¦¿¬
2020-03   2699   ¾Æ±â°ßÀúÄ¿
2020-11   2699   ¸Þ°¡³¯¹é
2018-12   2699   ºñ¿¤À̺ê