반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | |||
5 | 6 | 7 | 8 | 9 | 10 | 11 |
12 | 13 | 14 | 15 | 16 | 17 | 18 |
19 | 20 | 21 | 22 | 23 | 24 | 25 |
26 | 27 | 28 | 29 | 30 | 31 |
Tags
- docker
- nginx
- mongodb operator
- linux
- WEB
- DOIK
- devops #jenkins
- 컨테이너
- 쿠버네티스
- k8s
- bash
- devops #engineer
- variable
- 초간단파이썬
- namespace
- ioredirection
- multivm
- 파이썬
- Engineer
- Kubernetes
- Strimzi
- httpd실행
- springboot
- RSS
- container
- java
- aws #engineer
- 도커
- python
- Vagrant
Archives
- Today
- Total
샤인의 IT (막 적는) 메모장
[Bash] 기본 작성 ( + WEB 서버 실행 스크립트) 본문
반응형
기본 문법
스크립트 작성 및 Permission 부여한 후 실행
[root@scriptbox scripts]# cat firstscript.sh
#!/bin/bash
### This script prints system info ###
echo "Welcome to Bash script"
echo
#Check system time
echo "###############################"
echo "The uptime of the system is: "
uptime
#Memory Check
echo "###############################"
echo "Memory Utilization"
free -m
#Disk Check
echo "###############################"
echo "Disk Utilization"
df -h
#Shell 실행권한 부여
chmod +x firstscript.sh
#스크립트 실행
[root@scriptbox scripts]# ./firstscript.sh
Template을 설치하여 WEB 서버를 실행하는 스크립트
#httpd script
[root@scriptbox scripts]# cat websetup.sh
#!/bin/bash
# Package Install
sudo yum -y install wget unzip httpd > /dev/null
# Start httpd
echo "Start httpd"
echo "###################################"
sudo systemctl start httpd
sudo systemctl enable httpd
#templete Setup
echo "Templete Setup"
echo "###################################"
mkdir -p /tmp/webfiles
cd /tmp/webfiles
wget https://www.tooplate.com/zip-templates/2124_vertex.zip > /dev/null
unzip 2124_vertex.zip
sudo cp -r 2124_vertex/* /var/www/html/
#restart httpd
echo "httpd restart...."
echo "###################################"
sudo systemctl restart httpd
rm -rf /tmp/webfiles
반응형
'Programming > Bash' 카테고리의 다른 글
[Bash] Export Variable (0) | 2022.01.22 |
---|---|
[Bash] Quota & Substitution (0) | 2022.01.22 |
[Bash] Command Line Argument (0) | 2022.01.22 |
[Bash] Variable (0) | 2022.01.22 |
Comments