<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Scripts :: Ay Docs</title>
    <link>https://ops.docs.72602.space/linux/scripts/index.html</link>
    <description>Create Systemd Service Disable Service Free Disk Space Login Without Pwd Set Http Proxy</description>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Fri, 14 Mar 2025 15:00:59 +0800</lastBuildDate>
    <atom:link href="https://ops.docs.72602.space/linux/scripts/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Create Systemd Service</title>
      <link>https://ops.docs.72602.space/linux/scripts/create_systemd_service/index.html</link>
      <pubDate>Fri, 14 Mar 2025 15:00:59 +0800</pubDate>
      <guid>https://ops.docs.72602.space/linux/scripts/create_systemd_service/index.html</guid>
      <description>创建 systemd 服务文件 vim /etc/systemd/system/your-service-name.service 添加以下内容到文件中 运行一个脚本 [Unit] Description=Your Service Description After=network.target # after: 指定在哪些服务之后启动 [Service] Type=simple # simple: 运行一个简单的程序 | forking: 服务会fork出新的进程 | oneshot: 运行一次 | notify: 运行并等待通知 | exec: 运行一个命令 User=root ExecStart=/bin/bash -c &#34;your-bash-command-here&#34; Restart=always RestartSec=5 [Install] WantedBy=multi-user.target # multi-user.target: 运行在多用户模式下的目标 运行一个程序 [Unit] Description=Backup Service After=network.target [Service] Type=simple User=root ExecStart=/bin/bash -c &#34;tar -czf /backup/backup-$(date +%Y%m%d).tar.gz /home/user/data&#34; Restart=on-failure [Install] WantedBy=multi-user.target 启动服务 # 重新加载 systemd 配置 sudo systemctl daemon-reload # 启动服务 sudo systemctl start your-service-name # 设置开机启动 sudo systemctl enable your-service-name # 检查服务状态 sudo systemctl status your-service-name # 停止服务 sudo systemctl stop your-service-name # 禁用开机启动 sudo systemctl disable your-service-name # 查看服务日志 sudo journalctl -u your-service-name -f</description>
    </item>
    <item>
      <title>Disable Service</title>
      <link>https://ops.docs.72602.space/linux/scripts/disable_service/index.html</link>
      <pubDate>Thu, 14 Mar 2024 15:00:59 +0800</pubDate>
      <guid>https://ops.docs.72602.space/linux/scripts/disable_service/index.html</guid>
      <description>Disable firewall、selinux、dnsmasq、swap service systemctl disable --now firewalld systemctl disable --now dnsmasq systemctl disable --now NetworkManager setenforce 0 sed -i &#39;s#SELINUX=permissive#SELINUX=disabled#g&#39; /etc/sysconfig/selinux sed -i &#39;s#SELINUX=permissive#SELINUX=disabled#g&#39; /etc/selinux/config reboot getenforce swapoff -a &amp;&amp; sysctl -w vm.swappiness=0 sed -ri &#39;/^[^#]*swap/s@^@#@&#39; /etc/fstab</description>
    </item>
    <item>
      <title>Free Disk Space</title>
      <link>https://ops.docs.72602.space/linux/scripts/cleanup/index.html</link>
      <pubDate>Thu, 14 Mar 2024 15:00:59 +0800</pubDate>
      <guid>https://ops.docs.72602.space/linux/scripts/cleanup/index.html</guid>
      <description>Cleanup find first 10 biggest files dnf install ncdu # 找出当前目录下最大的10个文件/目录 du -ah . | sort -rh | head -n 10 # 找出家目录下大于100M的文件 find ~ -type f -size +100M -exec ls -lh {} \; | awk &#39;{ print $9 &#34;: &#34; $5 }&#39; clean cache rm -rf ~/.cache/* sudo rm -rf /tmp/* sudo rm -rf /var/tmp/* clean images # 删除所有停止的容器 podman container prune -y # 删除所有未被任何容器引用的镜像（悬空镜像） podman image prune # 更激进的清理：删除所有未被运行的容器使用的镜像 podman image prune -a # 清理构建缓存 podman builder prune # 最彻底的清理：删除所有停止的容器、所有未被容器使用的网络、所有悬空镜像和构建缓存 podman system prune podman system prune -a # 更加彻底，会删除所有未被使用的镜像，而不仅仅是悬空的</description>
    </item>
    <item>
      <title>Login Without Pwd</title>
      <link>https://ops.docs.72602.space/linux/scripts/login_without_pwd/index.html</link>
      <pubDate>Thu, 14 Mar 2024 15:00:59 +0800</pubDate>
      <guid>https://ops.docs.72602.space/linux/scripts/login_without_pwd/index.html</guid>
      <description>copy id_rsa to other nodes yum install sshpass -y mkdir -p /extend/shell cat &gt;&gt;/extend/shell/distribute_pub.sh&lt;&lt; EOF #!/bin/bash ROOT_PASS=root123 ssh-keygen -t rsa -f ~/.ssh/id_rsa -P &#39;&#39; for ip in 101 102 103 do sshpass -p\$ROOT_PASS ssh-copy-id -o StrictHostKeyChecking=no 192.168.29.\$ip done EOF cd /extend/shell chmod +x distribute_pub.sh ./distribute_pub.sh</description>
    </item>
    <item>
      <title>Set Http Proxy</title>
      <link>https://ops.docs.72602.space/linux/scripts/set_http_proxy/index.html</link>
      <pubDate>Thu, 14 Mar 2024 15:00:59 +0800</pubDate>
      <guid>https://ops.docs.72602.space/linux/scripts/set_http_proxy/index.html</guid>
      <description>[Optional] Install Proxy Server go and check http://port.72602.online/ops/hugo/index.html Set Http Proxy export https_proxy=http://47.110.67.161:30890 export http_proxy=http://47.110.67.161:30890 Use Proxy in Pod</description>
    </item>
  </channel>
</rss>