-
Notifications
You must be signed in to change notification settings - Fork 0
/
install_script
49 lines (40 loc) · 987 Bytes
/
install_script
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash
# Check if script is run as root
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit 1
fi
# Install dependencies
apt-get update
apt-get install -y nginx docker.io jq
# Copy the main script to /usr/local/bin
cp devopsfetch /usr/local/bin/
chmod +x /usr/local/bin/devopsfetch
# Set up systemd service
cat << EOF > /etc/systemd/system/devopsfetch.service
[Unit]
Description=DevOps Information Retrieval Service
After=network.target
[Service]
ExecStart=/usr/local/bin/devopsfetch -t '1 hour ago'
Restart=always
User=root
[Install]
WantedBy=multi-user.target
EOF
# Enable and start the service
systemctl enable devopsfetch.service
systemctl start devopsfetch.service
# Set up log rotation
cat << EOF > /etc/logrotate.d/devopsfetch
/var/log/devopsfetch.log {
daily
rotate 10
compress
delaycompress
missingok
notifempty
create 0640 root root
}
EOF
echo "Installation completed successfully! The devopsfetch service is now running."