我尝试使用 apt-get remove cupsd 但我在不同的位置发现了它的痕迹,它仍在运行和监听。我怎样才能从我的机器上完全撕掉它?可以去掉杯子的dpkg吗?
我正在使用薄荷 17
Linux 用户虚拟机 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:08:14 UTC 2014 i686 i686 i686 GNU/Linux
virtual-machine # netstat -an | more
unix 2 [ ACC ] STREAM LISTENING 15350 /var/run/cups/cups.sock
virtual-machine # netstat -tulpn
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN 2711/cupsd
tcp6 0 0 ::1:631 :::* LISTEN 2711/cupsd
# find / -name cups
/run/cups
/etc/ufw/applications.d/cups
/etc/init.d/cups
/etc/default/cups
/etc/cups
/usr/lib/cups
/usr/share/doc/cups
/usr/share/linuxmint/common/artwork/cups
/usr/share/doc-base/cups
/usr/share/cups
/var/spool/cups
/var/lib/doc-base/omf/cups
/var/lib/doc-base/documents/cups
/var/log/cups
/var/cache/cups
# apt-cache pkgnames cups
cups-driver-gutenprint …Run Code Online (Sandbox Code Playgroud) 在systemd 中使用RHEL7
您是否必须使用特定的文件名约定/etc/security/limits.d(除了以 结尾的文件.conf)?这个目录中有一个文件叫做20-nproc.conf. 因此,如果我想提高打开文件限制,USER1我将如何命名此.conf文件?第一个数字重要吗?IE。20在 .conf 文件中20-nproc.conf
我应该.conf在/etc/security/limits.d目录中创建它,因为/etc/security/limits.conf状态:
Also note that configuration files in /etc/security/limits.d directory,
which are read in alphabetical order, override the settings in this
file in case the domain is the same or more specific.
...
Run Code Online (Sandbox Code Playgroud)
我可以创建一个名为的 .conf 文件吗 30-USER1-nofile.conf
其中包含
USER1 soft nofile 6000
USER1 hard nofile 6000
Run Code Online (Sandbox Code Playgroud) 如何让以下服务单元按0-3(0,1,2,3)的顺序启动?我尝试启用 echo-date-1.service 思维,它将需要 echo-date-2,这将需要 echo-date-3,这将需要 echo-date-0,因此首先启动 echo-date-0,然后启动回显日期-1,2,3。当我检查 systemd-analyze 图时,顺序看起来错误:
\n\n\n\n-------------------\necho-date-1.service\n-------------------\n[Unit]\nDescription=Start echo-date-1\nRequires=echo-date-2.service\n**After=echo-date-0.service**\n\n[Service]\nExecStart=/home/USER/bash/echo-date-1.sh\n\n[Install]\nWantedBy=multi-user.target\n\n\n\n-------------------\necho-date-2.service\n-------------------\n[Unit]\nDescription=Start echo-date-2\nRequires=echo-date-3.service\n**After=echo-date-1.service**\n\n[Service]\nExecStart=/home/USER/bash/echo-date-2.sh\n\n[Install]\nWantedBy=multi-user.target\n\n\n\n-------------------\necho-date-3.service\n-------------------\n[Unit]\nDescription=Start echo-date-3\nRequires=echo-date-0.service\n**After=echo-date-2.service**\n\n[Service]\nExecStart=/home/USER/bash/echo-date-3.sh\n\n[Install]\nWantedBy=multi-user.target\n\n\n\n\n-------------------\necho-date-0.service\n-------------------\n[Unit]\nDescription=Start echo-date-0\n\n[Service]\nExecStart=/home/USER/bash/echo-date-0.sh\n\n[Install]\nWantedBy=multi-user.target\nRun Code Online (Sandbox Code Playgroud)\n\n编辑: \n我相信我已经成功了。我必须在服务文件的Unit部分中同时使用Requires和After 。仅使用Requires或After不起作用;我必须同时使用两者。是否有一个原因?
\n\n这是 systemd-analyze 绘图输出和服务文件的 systemctl 状态(参见 PID 号)
\n\n\n\n\xe2\x97\x8f echo-date-0.service - Start echo-date-0\n Loaded: loaded (/etc/systemd/system/echo-date-0.service; disabled; vendor preset: disabled)\n Active: inactive (dead) since Tue 2017-07-18 16:04:43 EDT; 9min ago\n Process: 281 ExecStart=/home/USER/bash/echo-date-0.sh (code=exited, status=0/SUCCESS)\n Main PID: 281 (code=exited, status=0/SUCCESS)\n\nJul 18 16:04:43 localhost systemd[1]: Started Start echo-date-0.\n\n\xe2\x97\x8f echo-date-1.service - …Run Code Online (Sandbox Code Playgroud) 如何让下面的定时器自动启动?现在计时器只有在我这样做时才起作用systemctl start while-test.timer。否则,即使我启用了计时器,它也不会自动启动。即使在执行systemctl daemon-reload或重新启动之后。
while-test .service
-------------------
[Unit]
Description=While loop test script
[Service]
Type=simple
ExecStart=/home/user/bash/while-test.sh
[Install]
WantedBy=default.target
Run Code Online (Sandbox Code Playgroud)
和
while-test .timer
----------------
[Unit]
Description=While loop test script timer
[Timer]
OnCalendar=Mon *-*-* 10:52:00
Unit=while-test.service
[Install]
WantedBy=default.service
Run Code Online (Sandbox Code Playgroud) 是否可以安全地忽略上述错误消息?或者是否可以删除空字节?我尝试删除它,tr但我仍然收到相同的错误消息。
这是我的脚本:
#!/bin/bash
monitordir="/home/user/Monitor/"
tempdir="/home/user/tmp/"
logfile="/home/user/notifyme"
inotifywait -m -r -e create ${monitordir} |
while read newfile; do
echo "$(date +'%m-%d-%Y %r') ${newfile}" >> ${logfile};
basefile=$(echo ${newfile} | cut -d" " -f1,3 --output-delimiter="" | tr -d '\n');
cp -u ${basefile} ${tempdir};
done
Run Code Online (Sandbox Code Playgroud)
当我运行inotify-create.sh并在其中创建一个新文件时"monitordir"
我得到:
[@bash]$ ./inotify-create.sh
Setting up watches. Beware: since -r was given, this may take a while!
Watches established.
./inotify-create.sh: line 9: warning: command substitution: ignored null byte in input
Run Code Online (Sandbox Code Playgroud) 仅当另一个服务单元运行没有任何错误时,我如何才能启动一个服务单元?
我有 2 个服务单位:
#echo-date-0.service
[Unit]
Description=
[Service]
ExecStart=/home/user/bash/echo-date-0.sh
[Install]
WantedBy=multi-user.target
#echo-date-1.service
[Unit]
Description=
[Service]
ExecStart=/home/user/bash/echo-date-1.sh
Requires=echo-date-0.service
After=echo-date-0.service
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
我有脚本 echo-date-0.sh 返回退出代码 1(退出 1),如果我检查 echo-date-0.service 的状态,我会看到:
Active: failed (Result:exit-code)
Process: (code=exited, status=1/FAILURE)
Run Code Online (Sandbox Code Playgroud)
但是,echo-date-1.service 运行,即使我有它需要 echo-date-0.service。如果 echo-date-0.service 失败,如何停止 echo-date-1.service 运行?
我在哪里可以检查/验证 sshd 正在使用哪个配置文件?我知道您可以使用-f命令更改要使用的配置文件,但是有没有办法回显当前正在使用哪个配置文件,或者是否有我可以查看的文件来检查这个?
有人可以解释这两个代码块之间的区别吗?我认为 Block #2 会输出与 Block #1 相同的输出,但事实并非如此。有人可以解释为什么吗?
# ./arguments.sh hello my name is X
Run Code Online (Sandbox Code Playgroud)
第 1 块
for i
do
echo $i
done
Run Code Online (Sandbox Code Playgroud)
输出:
hello
my
name
is
X
Run Code Online (Sandbox Code Playgroud)
块 #2
args=$#
for (( i=1; i<=$args; i+=1 ))
do
echo $i
done
Run Code Online (Sandbox Code Playgroud)
输出:
1
2
3
4
5
Run Code Online (Sandbox Code Playgroud) 在匹配所有以 开头的行后,如何将输出的第一行存储为标题/dev/nvme?
现在我打了df两次电话,但我想用 awk 一次性完成。
df -h | grep '^Filesystem' && df -h | grep '^/dev/nvme'
Run Code Online (Sandbox Code Playgroud)
期望的结果是:
Filesystem Size Used Avail Use% Mounted on
/dev/nvme0n1p2 ...
/dev/nvme0n1p1 ...
Run Code Online (Sandbox Code Playgroud)