AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-480349

acgbox's questions

Martin Hope
acgbox
Asked: 2023-10-08 07:50:25 +0800 CST

获取具有 crontab root 的用户

  • 5

我myscript.sh在根 crontab 中运行计划,我需要它来检测非根用户(系统启动时使用的用户)。

我尝试过这些变体:

local_user=${who -m | awk '{print $1;}'}

local_user=${logname 2>/dev/null || echo $SUDO_USER}

local_user=$(logname)

local_user=$(ps -o user= -p $$)

local_user=${SUDO_UID:-$(id -u)}

local_user=$(id -u $(logname))

if [ "$EUID" -eq 0 ]; then
   local_user=$SUDO_USER
else
   local_user=$(whoami)
fi

# or

if [ -n "$SUDO_USER" ]; then
     local_user="$SUDO_USER"
else
     local_user="$(whoami)"
fi

唯一有效的是:

local_user=${SUDO_USER:-$(whoami)}
local_user=${SUDO_USER:-$USER}

但只有当我使用 sudo 或从 root 帐户手动运行脚本时它们才起作用,但它在 crontab root 中不起作用。

例子:

#!/bin/bash
local_user=${SUDO_USER:-$(whoami)}
echo "my user is $local_user" | tee /var/log/syslog

# run crontab
*/1 * * * * /home/user/test/test.sh
my user is root

# run manual
root@foo:/home/user/test# ./test.sh 
my user is user

任何想法?

发布:ubuntu 22.04

更新:已解决!

我在这里找到:https ://unix.stackexchange.com/a/617686/266428

local_user=$(ps -eo user,uid | awk 'NR>1 && $2 >= 1000 && ++seen[$2]==1{print $1}')

或者

local_user=$(who | head -1 | awk '{print $1;}')

bash
  • 1 个回答
  • 39 Views
Martin Hope
acgbox
Asked: 2023-04-17 23:31:58 +0800 CST

虚拟内存可以超过物理内存吗?(内存+硬盘)?

  • 5

glances 程序显示谷歌浏览器页面消耗 1.10 TB 虚拟内存,而我的 PC 没有这个容量(RAM + 硬盘驱动器)。 在此处输入图像描述

关于这一点,quora解释如下:“虚拟内存可以超过物理内存。虚拟内存是一种系统内存管理技术,它允许程序通过临时将数据传输到磁盘存储来使用比计算机上物理可用的内存更多的内存。这允许即使所有物理内存都在使用中,程序也能继续运行。”

案例具体:如果PC有16GB RAM + 500GB SSD,虚拟内存是否有可能在单个进程中超过物理内存并达到1.10 TB?

思

linux
  • 1 个回答
  • 33 Views
Martin Hope
acgbox
Asked: 2023-01-19 15:59:04 +0800 CST

没有 WAN 的子网声明

  • 6
  • 我有 2 个enp0s3用于 WAN 和enp0s8LAN 的网卡。
  • WAN 具有动态 IP 地址(从 ISP 接收)。
  • LAN 为我的本地网络提供 C 类静态 IP 地址
  • 我有带有此配置的 isc-dhcp-server:
nano /etc/dhcp/dhcpd.conf

# ISC-DHCP-Server Configuration
authoritative;
option wpad code 252 = text;
server-identifier 192.168.0.10;
deny duplicates;
one-lease-per-client true;
deny declines;
deny client-updates;
ping-check true;
log-facility local7;
ddns-update-style none;


    host user3 {
    hardware ethernet 40:e2:30:f4:00:04;
    fixed-address 192.168.0.90;
    }

    host user1 {
    hardware ethernet 40:e2:30:f4:00:02;
    fixed-address 192.168.0.50;
    }

class "blockdhcp" {
     match pick-first-value (option dhcp-client-identifier, hardware);
    }
    subclass "blockdhcp" 1:90:68:c3:00:00:00;

subnet 192.168.0.0 netmask 255.255.255.0 {
    option routers 192.168.0.10;
    option subnet-mask 255.255.255.0;
    option broadcast-address 192.168.0.255;
    #option domain-name "example.org";
    option domain-name-servers 8.8.8.8,8.8.4.4;
    min-lease-time 2592000; # 30 days
    default-lease-time 2592000; # 30 days
    max-lease-time 2592000; # 30 days
    pool {
        min-lease-time 60;
        default-lease-time 60;
        max-lease-time 60;
        deny members of "blockdhcp";
        range 192.168.0.100 192.168.0.250;
    }
}

问题是 isc-dhcp-server 显示错误消息No subnet declaration for enp0s3 (10.0.2.15)因为它要求我为 WAN 分配一个范围,这是不可能的,因为它是动态的,ISP 提供商最终可以更改IP

sudo systemctl status isc-dhcp-server
● isc-dhcp-server.service - ISC DHCP IPv4 server
     Loaded: loaded (/lib/systemd/system/isc-dhcp-server.service; enabled; vendor preset: enabled)
     Active: active (running) since Wed 2023-01-18 18:29:32 -05; 7min ago
       Docs: man:dhcpd(8)
   Main PID: 17055 (dhcpd)
      Tasks: 4 (limit: 19112)
     Memory: 4.9M
        CPU: 24ms
     CGroup: /system.slice/isc-dhcp-server.service
             └─17055 dhcpd -user dhcpd -group dhcpd -f -4 -pf /run/dhcp-server/dhcpd.pid -cf /etc/dhcp/dhcpd.conf

ene 18 18:29:32 uservm dhcpd[17055]: Sending on   LPF/enp0s8/08:00:27:8d:e7:c9/192.168.0.0/24
ene 18 18:29:32 uservm dhcpd[17055]: 
ene 18 18:29:32 uservm dhcpd[17055]: No subnet declaration for enp0s3 (10.0.2.15).
ene 18 18:29:32 uservm dhcpd[17055]: ** Ignoring requests on enp0s3.  If this is not what
ene 18 18:29:32 uservm dhcpd[17055]:    you want, please write a subnet declaration
ene 18 18:29:32 uservm dhcpd[17055]:    in your dhcpd.conf file for the network segment
ene 18 18:29:32 uservm dhcpd[17055]:    to which interface enp0s3 is attached. **
ene 18 18:29:32 uservm dhcpd[17055]: 
ene 18 18:29:32 uservm dhcpd[17055]: Sending on   Socket/fallback/fallback-net
ene 18 18:29:32 uservm dhcpd[17055]: Server starting service.

如何避免这种情况,使这些充斥日志的错误消息不再出现?提前致谢

networking
  • 2 个回答
  • 51 Views
Martin Hope
acgbox
Asked: 2022-11-25 08:25:13 +0800 CST

执行 restore ipset 时如何组织 IP/CIDR?

  • 5

我有这个 ipset v7.15 的 bash 脚本(在 ubuntu 22.04 中运行),由Martin提供(我对这个问题做了一些修改):

ipset create -! blacklist hash:net family inet hashsize 1024
ipset save -! > /tmp/ipset.txt

cat list.txt | sort -t . -k 1,1n -k 2,2n -k 3,3n -k 4,4n -k 5,5n -k 6,6n -k 7,7n -k 8,8n -k 9,9n | while read line; do
    echo "add blacklist $line" >> /tmp/ipset.txt
done
ipset restore -! < /tmp/ipset.txt

内容list.txt:

125.74.0.0/15
1.0.132.249
125.73.0.0/16
130.255.128.0/20
125.76.0.0/17

出/tmp/ipset.txt:

create blacklist hash:net family inet hashsize 1024 maxelem 65536 bucketsize 12 initval 0xf164f1c6
add blacklist 1.0.132.249
add blacklist 125.73.0.0/16
add blacklist 125.74.0.0/15
add blacklist 125.76.0.0/17
add blacklist 130.255.128.0/20

出ipset -L(问题):

sudo ipset -L
Name: blacklist
Type: hash:net
Revision: 7
Header: family inet hashsize 1024 maxelem 65536 bucketsize 12 initval 0xf164f1c6
Size in memory: 696
References: 0
Number of entries: 5
Members:
125.74.0.0/15
1.0.132.249
125.73.0.0/16
130.255.128.0/20
125.76.0.0/17

如您所见,blacklist输出中的 IP/CIDR 乱七八糟(没有sort)。

Ipset 有这个选项:

-s, -sorted
Sorted output. When listing or saving sets, the entries are listed sorted.

但是我用下面的命令试了一下,输出是一样的(没有sort。也许我没有正确使用它):

ipset restore -! -s < /tmp/ipset.txt

如果我-!从命令中删除选项restore,我会收到以下错误:

ipset v7.15: Error in line 1: Set cannot be created: set with the same name already exists

所以,我认为我的脚本有错误,因为它添加了我认为不应该存在的一行:

create blacklist hash:net family inet hashsize 1024 maxelem 65536 bucketsize 12 initval 0xf164f1c6

然后我可以删除该save行以避免错误,将其保留如下:

ipset -! create blacklist hash:net family inet hashsize 1024
cat list.txt | while read line; do
    echo "add blacklist $line" >> /tmp/ipset.txt
done
ipset -s restore -f /tmp/ipset.txt

但是当我运行时输出保持不变,没有排序,ipset -L所以-sorted(-s) 选项在restore

我怎样才能解决这个问题,以便组织输出?

linux
  • 1 个回答
  • 59 Views
Martin Hope
acgbox
Asked: 2022-11-17 05:30:17 +0800 CST

如何使用 ipset 保存和恢复选项添加多个 ips cidr

  • 5

我有这个循环来使用 ipset/iptables 阻止 IP 和 CIDR:

# this is just an example. the actual list IPs/CIDR is very large
cat blockip.txt
13.31.0.254
cat blockcidr.txt
13.32.0.0/15

环形:


#!/bin/bash
ipset -F
ipset -N -! blacklist hash:net maxelem 1000000
for ip in $(cat blockip.txt blockcidr.txt); do
    ipset -A blacklist $ip
done
iptables -A FORWARD -m set --match-set blacklist dst -j DROP

注意:我一直使用这个ipset -A选项,但我不知道这个选项到底是什么意思,因为它没有出现在“ Man Ipset ”中,此时,我假设它add与 相同-A,因为输出在这两种情况下都是一样的。

#!/bin/bash
ipset -F
ipset -N -! blacklist hash:net maxelem 1000000
for ip in $(cat blockip.txt blockcidr.txt); do
    ipset add blacklist $ip -q
done
iptables -A FORWARD -m set --match-set blacklist dst -j DROP

两种情况:

sudo ipset -L
Name: blacklist
Type: hash:net
Revision: 7
Header: family inet hashsize 1024 maxelem 1000000 bucketsize 12 initval 0xbc0136c8
Size in memory: 552
References: 0
Number of entries: 2
Members:
13.31.0.254
13.32.0.0/15

“它工作正常”,但我读到添加 IP 和 CIDR 的ipset -A速度非常慢。使用ipset save 和 restore哪个更快。但我不明白它是如何工作的,我的尝试失败了:

注意:我还没有找到解释为什么使用保存/恢复选项而不是addor更快的解释-A

#!/bin/bash
ipset -F
ipset -N -! blacklist hash:net maxelem 1000000
for ip in $(cat blockip.txt blockcidr.txt); do
    ipset add blacklist $ip # ??
    ipset save blacklist -f newblacklist.txt # ???
done
ipset restore -! < newblacklist.txt # ??
iptables -A FORWARD -m set --match-set blacklist dst -j DROP # ??

出去:

sudo ipset -L
Name: blacklist
Type: hash:net
Revision: 7
Header: family inet hashsize 1024 maxelem 1000000 bucketsize 12 initval 0xcb0e583b
Size in memory: 552
References: 0
Number of entries: 2
Members:
13.32.0.0/15
13.31.0.254

cat newblacklist.txt # out wrong
create blacklist hash:net family inet hashsize 1024 maxelem 1000000 bucketsize 12 initval 0xcb0e583b
add blacklist 13.32.0.0/15
add blacklist 13.31.0.254

我将不胜感激任何帮助(提供完整的答案,包括建议的循环或对我的循环的更正)

iptables
  • 1 个回答
  • 36 Views
Martin Hope
acgbox
Asked: 2022-10-16 16:06:12 +0800 CST

如何使用查找按日期排除文件夹?

  • 1

这是“我的文件夹”:

tree -a 'myfolder'
myfolder
├── 20220902
│   ├── filefoo
│   └── filebar
├── 20221001
│   ├── filefoo
│   └── filebar
└── 20221015
    ├── filefoo
    ├── filebar
    └── filexyz
  etc...

我的命令:

find $folder/$(date +"%Y%m"*) -type f | xargs -I {} awk '/^total:/{sub(".*/", "", FILENAME); print FILENAME" "$NF}' {})

问题:我需要排除周末。我该怎么做?

PD:我知道在 bash/awk 中它是

%u The weekday as a decimal number (1–7). Monday is day one.

谢谢

更新解决!

我在 stackoverflow HERE中找到了答案

linux
  • 1 个回答
  • 52 Views
Martin Hope
acgbox
Asked: 2022-10-06 09:09:54 +0800 CST

在 linux 上,访问控制列表 ACL 的推荐扩展是什么?

  • 0

我已经阅读了许多关于在 iptables、squid 等 linux 上的程序中使用 ACL 的 HowTo、电子书、互联网页面等。在示例中,它们使用以下文件扩展名:

file.lst
file.acl
file.txt
file (no extension)

在示例中,ACL 的内容是多种多样的(url、IP 地址、MAC 地址等)

问题:在 linux 上,针对这些目的和这些内容的访问控制列表 ACL 的推荐扩展是什么?

先谢谢了

linux
  • 1 个回答
  • 34 Views
Martin Hope
acgbox
Asked: 2022-10-01 08:55:37 +0800 CST

如何从文件中提取值,将其与变量进行比较并发送到输出文件

  • 1

我的文件夹中有这些文件:

ls myfolder
filefoo filebar filefoobar

例如,filefoo 的内容是:

total: 379400041
cache_object://localhost/active_requests    379400041       6778    0-13955161 0-14111309 0-12250718 0-11422369 0-11901178 0-11781835 0-12687756 0-17663930 5-110207691 6-123940805 2-39477289 0-0 0-0 0-0 0-0 0-0 0-0 0-0 0-0 0-0 0-0 0-0 0-0 0-0
bla bla bla

注:其余文件内部结构相同,但编号有所变化

所以我有兴趣从这些文件中提取的值是“总数:数字”。这个值总是在每个文件的第一行:

find myfolder -type f -exec awk '/^total:/{print $NF}' {} +
379400041
35402285
8589934592

我应该将它与这个变量进行比较:

max="1073741824"

所以我需要的是,如果这些值中的任何一个超过 $max 变量(值 > $max),它应该将文件输出到输出列表。示例(非功能性):


if (( "value" > "$max" )); then
# or if [ "value" -gt "$max" ]; then
    the command to send the file to a list is missing > output.lst
 else
    echo "do nothing"
fi

预期输出:

cat output.lst
filefoobar

因为 filefoobar 有 8589934592 并且这个值 > $max

怎么做?谢谢

linux
  • 1 个回答
  • 59 Views
Martin Hope
acgbox
Asked: 2022-02-10 06:50:27 +0800 CST

如何禁用 java.security 中的行以避免 javax.net.ssl.SSLHandshakeException?

  • 0

我需要禁用java.security 文件(java 8 SE)中的以下行:

jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
   DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
   include jdk.disabled.namedCurves

在窗户里

Windows 中的图像。

窗口路径:Program Files\Java\jre1.8.0_301\lib\security\java.security

禁用这些行的目的是避免出现以下错误消息:

Error: javax.net.ssl.SSLHandshakeException: No appropriate protocol 
(protocol is disabled or cipher suites are inappropriate)

以及此处发布的解决方案提案(即对这些行发表评论)。

我不确定在行首 (#) 是否会禁用这两个操作系统的注释。因为这个oracle文档说是//

无论哪个用于注释行,我也不知道是否有必要注释掉所有 3 行,或者只是注释掉第一行禁用所有 3。示例:

这边走:

# jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
   DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
   include jdk.disabled.namedCurves

还是那样?

# jdk.tls.disabledAlgorithms=SSLv3, TLSv1, TLSv1.1, RC4, DES, MD5withRSA, \
#   DH keySize < 1024, EC keySize < 224, 3DES_EDE_CBC, anon, NULL, \
#   include jdk.disabled.namedCurves

问题:

如何在 Windows 和 Linux 上注释掉(禁用)java.security文件中的前几行以避免“错误:javax.net.ssl.SSLHandshakeException”,或者有人向我解释是否有另一种解决方案,不同于已发布的解决方案

windows java linux
  • 1 个回答
  • 775 Views
Martin Hope
acgbox
Asked: 2021-02-17 11:36:24 +0800 CST

如何使用expect命令和.run程序替换yes命令

  • 1

我正在尝试运行的program.run :

  • 提出 2 个需要回答“y”的问题
  • 最后问第三个问题,即“按任意键退出”

在此处输入图像描述

此外,它没有“-y”选项。只有这个选项:

FreeFileSync installation parameters:
-h, --help    Show help
--directory   Change installation directory e.g. --directory /opt/FFS
--noshortcuts  Don't create desktop shortcuts

这些命令都不起作用:

yes | sudo ./program.run
yes y | sudo ./program.run
sudo sh -c 'yes y | ./program.run'
echo y | sudo ./program.run
# etc, etc

在此处输入图像描述

由于“是”命令似乎不起作用,我想尝试其他任何东西

在这个答案中,说:“.run 命令只是一组将由 sh 运行的命令。特定的 .run 文件可能需要 -y 选项,但通常你不能指望它。如果你需要自动化一些东西,考虑使用Expect "。

但我不知道如何使用Expect。一些帮助?

发行版:Ubuntu Mate 20.04 LTS

Bash 5.0.17(1)-release (x86_64-pc-linux-gnu)

更新:

我已经在官方网站上发布了这个问题,开发人员宣布在下一个版本中他们将添加参数:

./program.run --accept-license
bash command
  • 2 个回答
  • 201 Views
Martin Hope
acgbox
Asked: 2021-01-30 11:06:11 +0800 CST

如何使用 Squid 通过 https 阻止 mime_types?

  • 1

我有这个规则来阻止扩展:

acl bl_ext url_regex -i "/path_to/bl_ext.txt"
http_access deny workdays bl_ext

示例内容文件“bl_ext.txt”:

\.avi([a-zA-Z][0-9]*)?(\?.*)?$
\.m4a([a-zA-Z][0-9]*)?(\?.*)?$
\.m4r([a-zA-Z][0-9]*)?(\?.*)?$
\.m4v([a-zA-Z][0-9]*)?(\?.*)?$
\.mid([a-zA-Z][0-9]*)?(\?.*)?$
\.mov([a-zA-Z][0-9]*)?(\?.*)?$
\.mp3([a-zA-Z][0-9]*)?(\?.*)?$
\.mp4([a-zA-Z][0-9]*)?(\?.*)?$
\.mpeg4([a-zA-Z][0-9]*)?(\?.*)?$
\.mpeg([a-zA-Z][0-9]*)?(\?.*)?$
\.mpegps([a-zA-Z][0-9]*)?(\?.*)?$
\.mpg([a-zA-Z][0-9]*)?(\?.*)?$
#etc, etc, etc

而这条规则来阻止 mime_type:

acl bl_mt rep_mime_type -i "/path_to/bl_mt.txt"
http_reply_access deny bl_mt

示例内容文件“bl_mimetype.txt”:

^audio/mp4$
^audio/mpeg$
^audio/wav$
^audio/.wma$
^audio/x-midi$
^audio/x-mp3$
^audio/x-mp4$
^audio/x-mpeg$
^audio/x-mpegurl$
^audio/x-ms-wma$
^audio/x-pn-realaudio$
^audio/x-pn-realaudio-plugin$
^audio/x-scpls$
^audio/x-wav$
^video/
^video/3gpp$
^video/avi$
^video/flash$
^video/flv$
^video/mp4$
^video/mpeg$
^video/mpeg4$
^video/ogg$
# etc, etc, etc

但这些规则不起作用。根据我做的分析,好像squid在是https加密流量的时候是无法屏蔽扩展的(http only)

PD:此外,我尝试了在互联网上找到的这些规则,但都没有:

acl video rep_header Content-Type video\/.*
acl audio rep_header Content-Type audio\/.*
http_reply_access deny video
http_reply_access deny audio

和:

acl mediapr urlpath_regex \.(avi|mp4|mov|m4v|mkv|flv|mpg|mpeg|wmv|rmvb|afx|asf|swf)(\?.*)?$
acl mediaprapp url_regex dvrplayer mediastream ^mms://
http_access deny mediapr mediaprapp
# Media Streams
acl media rep_mime_type ^application/x-shockwave-flash$
acl media rep_mime_type ^video/x-ms-asf$
acl media rep_mime_type ^application/vnd.ms.wms-hdr.asfv1$
acl media rep_mime_type ^application/x-mms-framed$
acl media rep_mime_type ^audio/x-pn-realaudio$
acl media rep_mime_type ^video/
acl media rep_mime_type ^video\/
acl media rep_mime_type ^application/x-shockwave-flash
acl media rep_mime_type ^application/vnd.ms.wms-hdr.asfv1
acl media rep_mime_type ^application/x-fcs
acl media rep_mime_type ^application/x-mms-framed
acl media rep_mime_type ^video/x-ms-asf
acl media rep_mime_type ^audio/mpeg
acl media rep_mime_type ^audio/x-scpls
acl media rep_mime_type ^video/x-flv
acl media rep_mime_type ^video/mpeg4
acl media rep_mime_type ms-hdr
acl media rep_mime_type x-fcs
acl media rep_mime_type mms
acl media rep_mime_type x-ms-asf
acl media rep_mime_type video/flv
acl media rep_mime_type video/x-flv
http_reply_access deny media

但什么也没有发生

有没有办法在代理缓存模式(不透明 - 拦截)下通过 https(不使用 SSL Bumping)阻止 Squid 中的文件 mime_type 文件扩展名?谢谢

PD:如果这肯定必须通过 SSL Bump 来完成,那么我不能。我想知道是否还有其他替代方案或其他程序(例如 ipset、fail2ban、没有字符串规则的 iptables,因为它们不可靠等)?

squid iptables
  • 1 个回答
  • 802 Views
Martin Hope
acgbox
Asked: 2020-06-12 14:27:36 +0800 CST

iptables 限制多端口规则的解决方法

  • 1

我有很多端口要阻止,但 iptables 多端口规则有一个限制,最多只允许 15 个端口。

severalports="1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16"
iptables -A INPUT -p tcp -m multiport --dports $severalports -J DROP
iptables v1.4.21: too many ports specified

我想知道是否有任何方法可以创建自定义规则来绕过最大 15 个端口的限制(所以我不必拆分规则)。谢谢

PD:Ports 1:16 只是为了解释这个想法。实际端口不按顺序

iptables ubuntu-20.04
  • 1 个回答
  • 1774 Views
Martin Hope
acgbox
Asked: 2020-03-04 15:14:34 +0800 CST

如何在cmd中停止、启动和删除一个windows服务并引用服务名

  • 1

如何仅使用服务名称的片段在 cmd 中停止/启动 Windows 服务。例子:

NET STOP *part_of_name_of_service*
NET START *part_of_name_of_service*

例如。mysql有许多版本的“服务名称”。

MySQL57
wampmysqld
etc, etc, etc

这个想法是停止/启动任何包含单词“mysql”的服务。像这样的东西:

net start *MySQL*

但不幸的是,我的尝试产生了错误:“服务名称无效”。

尝试:

1.使用以下命令将服务名称转储到文件中:

REG QUERY "HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services" > services.txt
findstr /i /r "mysql" services.txt
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\MySQL
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\wampmysqld64

但我无法完成循环

2.用taskkill

call :winservices "*mysql*"

:: funcion winservices
@echo off
  goto:eof
  :winservices
  set winservices=%1
   taskkill /f /im "%winservices%" /t
  goto:eof

但"*mysql*"不起作用(仅"mysql*"起作用)

尝试删除服务时也会发生同样的情况:

sc delete *MySQL*

我该怎么做?

windows-service mysql windows-command-prompt
  • 2 个回答
  • 694 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve