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

   Á¶È¸ 2797   Ãßõ 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 849/5689
2014-05   5009597   Á¤ÀºÁØ1
2015-12   1545330   ¹é¸Þ°¡
2022-02   2792   azchoi
2020-07   2792   refreshair
2019-03   2792   ¹Ý¼º¸¸
2019-12   2792   °­Çѱ¸
2020-04   2793   NGC
2019-02   2793   juaha
2020-11   2793   knufi
2019-08   2793   ±è°Ç¿ì
2020-08   2793   gruw
2021-05   2793   YunSeong
2020-08   2793   Á¨½Ã½ºÅÛÁî
2021-07   2793   NUXE
2021-03   2793   GPGPU
2019-05   2793   ¶óÀÌÁ¨
2020-04   2793   Æú¸®76
2019-02   2793   ¸Ó¶óÄ«´Âµ¥
2019-08   2793   ¿¥ºê¸®¿À
2020-03   2793   ¹öÁö´Ï¾Æ
2022-09   2793   ·¹¹ÝÅͽº
2020-08   2793   ³ë°¡¸®°­Ãß