
저는 일부 명령을 실행하고 파일을 syslog에 기록하는 우분투 서버용 쉘 스크립트를 작성 중입니다. sudo apt-get update가 실제로 업데이트되면 httpd 서버를 다시 시작하는 IF 문을 작성하고 싶습니다. If 문의 구문을 올바르게 작성한 다음 파일을 syslog에 기록하려면 어떻게 해야 합니까? 다음은 내 .sh 파일의 초안입니다. 미리 감사드립니다.
#!/bin/sh
sudo apt-get update
if [ update = true ]
then
< service httpd restart >
fi
sudo unzip randomnumber.zip -d /var/www/html
sudo apt-get autoclean