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

   Á¶È¸ 2736   Ãßõ 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 830/5686
2014-05   4984655   Á¤ÀºÁØ1
2015-12   1520664   ¹é¸Þ°¡
2020-12   2734   ÄÚ»Ô»ç³É
2019-03   2734   »ç¶ûÇ϶ó
2020-07   2734   Æĸ®´ë¿Õ
2019-11   2734   ÀÌÁ¤µ¿
2021-09   2734   epowergate
2021-06   2734   µð¼À¹ö
2018-12   2735   ±¼´Ù¸®±³
2020-04   2735   ±è½ÂÇö1
2019-12   2735   ¾È±Ô¹Î
2021-04   2735   ÂùÀÌ
2020-01   2735   Landa
2020-06   2735   »õ·Î¿îÂ÷¿ø
2020-12   2735   ¹èȸ
2021-06   2735   ºí·¢ÆÞ
2021-09   2735   ÀϷиӽºÅ©
2020-08   2735   »ê°ñ³óºÎ
2023-02   2736   ȸ¿ø
2019-04   2736   ¹Ý¼º¸¸
2020-04   2736   ÀÌ°ÇÈñ
2020-12   2736   ±¼··¼è