'use strict'; module.exports = { // strongswan相关命令 swIsEnabled: 'systemctl is-enabled strongswan-swanctl', // 查看strongswan服务是否开机自启动 swEnable: 'systemctl enable strongswan-swanctl', // 开启strongswan服务的自启动 swDisable: 'systemctl disable strongswan-swanctl', // 关闭strongswan服务的自启动 swStatus: 'systemctl status strongswan-swanctl', // 查看strongswan服务是否正在运行 swStart: 'systemctl start strongswan-swanctl', // 启动strongswan服务 swRestart: 'systemctl restart strongswan-swanctl', // 重启strongswan服务 swStop: 'systemctl stop strongswan-swanctl', // 停止strongswan服务 swReload: 'systemctl reload strongswan-swanctl', // openvpn相关命令 opIsEnabled: 'systemctl is-enabled openvpn', // 查看Openvpn是否开机自启动 opEnable: 'systemctl enable openvpn', // 打开Openvpn服务的自启动 opDisable: 'systemctl disable openvpn', // 关闭Openvpn服务的自启动 opStatus: 'systemctl status openvpn', // 查看Openvpn服务是否正在运行 opStart: 'systemctl start openvpn', // 启动Openvpn服务 opRestart: 'systemctl restart openvpn', // 重启Openvpn服务 opStop: 'systemctl stop openvpn', // 停止Openvpn服务 // dhcp相关命令 dhcpIsEnabled: 'systemctl is-enabled isc-dhcp-server', // 查看dhcp是否开机自启动 dhcpEnable: 'systemctl enable isc-dhcp-server', // 打开dhcp服务的自启动 dhcpDisable: 'systemctl disable isc-dhcp-server', // 关闭dhcp服务的自启动 dhcpStatus: 'systemctl status isc-dhcp-server', // 查看dhcp服务是否正在运行 dhcpStart: 'systemctl start isc-dhcp-server', // 启动dhcp服务 dhcpRestart: 'systemctl restart isc-dhcp-server', // 重启dhcp服务 dhcpStop: 'systemctl stop isc-dhcp-server', // 停止dhcp服务 // 网络配置相关命令 wanDown: 'ifconfig wan down', // 禁用wan网卡 wanUp: 'ifconfig wan up', // 启用wan网卡 lanDown: 'ifconfig br-lan down', // 禁用br-lan网卡 lanUp: 'ifconfig br-lan up', // 启用br-lan网卡 // 系统重启命令 reboot: 'reboot', // reboot后系统将自动重启 // 状态检测相关命令 // cpu使用率和内存使用率 deviceState: 'top | head -n 5', // 结果: // top - 08:51:46 up 2:49, 1 user, load average: 0.01, 0.11, 0.15 // Tasks: 87 total, 1 running, 46 sleeping, 0 stopped, 0 zombie // %Cpu(s): 1.4 us, 0.5 sy, 0.0 ni, 97.9 id, 0.0 wa, 0.1 hi, 0.1 si, 0.0 st // KiB Mem : 997064 total, 682744 free, 154900 used, 159420 buff/cache // KiB Swap: 0 total, 0 free, 0 used. 747584 avail Mem // CPU使用率:取第3行 97.9id(比如空闲CPU,100-97.9=2.1 即CPU使用率) // 内存使用率:取第4行 (997064-682744)/997064 // VPN连接状态 vpnState: 'swanctl -l | grep established', // 结果(如果已建立连接此显示类似如下信息): // 如果命令结果为空,表示未建立连接 // 如果命令显示类似:established 74s ago, rekeying in 13516s,表示已建立连接74s // 时间命令 // 获取当前时间 // date "+%Y-%m-%d %H:%M:%S" // 结果:2021-03-01 06:19:50 // 设置系统时间 // date -s "2021-03-01 06:19:50" // 结果:系统时间将被修改为:2021-03-01 06:19:50 // ntp时间同步命令 // 连接测试 // ping 192.168.88.10 // 恢复默认配置 configDefault: 'echo ok', };