小编Mar*_*ert的帖子

如何在不重启的情况下启动 cron 作业?

我使用 cron 作业offlineimap每 2 分钟调用一次:

*/2 * * * * /usr/bin/offlineimap > ~/Maildir/offlineimap.log 2>&1
Run Code Online (Sandbox Code Playgroud)

我需要终止 cron 作业来解决问题。我怎样才能重新启动 cron 作业(无需重新启动)?我在网上找到了这个“解决方案”:

mylogin@myhost:~$ sudo /etc/init.d/cron restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service cron restart

Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop cron ; start cron. The restart(8) utility is also available.
cron stop/waiting
cron …
Run Code Online (Sandbox Code Playgroud)

cron

11
推荐指数
1
解决办法
10万
查看次数

如何在横向模式下将 pdf 转换为 4-up(理想情况下使用 ghostscript)?

我有横向模式的 pdf 幻灯片,想创建一个新的 pdf 文件,其中包含幻灯片 4-up(再次处于横向模式),如下所示:

-----------------
|   1   |   2   |
-----------------
|   3   |   4   |
-----------------
Run Code Online (Sandbox Code Playgroud)

我知道有pdfjam(可以像这样使用pdfjam --fitpaper true --nup 2x2 --delta '1mm 1mm' --scale 0.98 infile.pdf),但它不保留超链接——gs尽管如此。我想知道如何使用它gs来完成任务(?)

或者,我主要使用 4-up 来打印幻灯片。我无法设法lpr用于实现这一目标。如果有人对此有想法,这也会很有趣。

pdf ghostscript

9
推荐指数
1
解决办法
2014
查看次数

lpr:如何指定页面范围“3 到结束”?

CUPS文档并没有说如何指定页面范围,如“3至结束”。这可以在不知道文档页数的情况下完成吗?所以像lpr -o page-ranges=3-end -P myprinter

printing cups

7
推荐指数
2
解决办法
7294
查看次数

如何提取以模式开头的行和两个模式之间的块?

我有infile.tex以下形式的文件(例如,)

AAAA
BBBB AAAA
CCCC BBBB AAAA

%%## Just some text
\begin{example}[foobar]
\begin{Sinput}
> set.seed(271)
> U <- runif(10)
> plot(U, 1-U)
\end{Sinput}
AAAA BBBB CCCC
\begin{Sinput}
> plot(qnorm(cbind(U, 1-U)))
\end{Sinput}
\end{example}
Run Code Online (Sandbox Code Playgroud)

我想提取所有以%%## and开头的行以及\begin{Sinput}and之间的所有行\end{Sinput},所以

%%## Just some text
\begin{Sinput}
> set.seed(271)
> U <- runif(10)
> plot(U, 1-U)
\end{Sinput}
\begin{Sinput}
> plot(qnorm(cbind(U, 1-U)))
\end{Sinput}
Run Code Online (Sandbox Code Playgroud)

我试图与sed

sed -n '/%%##\|\\begin{Sinput}/,/\\end{Sinput}/p' infile.tex # 但也包含 \begin{example}[foobar]

sed -n '/^%%##\|\\begin{Sinput}/,/\\end{Sinput}/p' infile.tex # 但不包含以开头的行 %%##

注意:上面的内容是从 …

sed shell-script

1
推荐指数
1
解决办法
118
查看次数

如何在 shell 脚本中删除参数(从参数列表中)?

我有以下(MWE)shell 脚本foo

#!/bin/bash
ARGS=("$@") # all arguments
## => if it exists, we need to drop the argument "-D" here
ls -l ${ARGS[@]} | sort -fk8 
Run Code Online (Sandbox Code Playgroud)

如果foo使用参数调用-D(参数列表中的位置未知),如何-D从参数列表中删除?unset ARGS[${#ARGS[@]}-1]例如,我发现可以删除最后一个参数,但我不确定参数的传递顺序(所以我首先需要知道参数在哪个位置,然后在提供的情况下将其删除)。

bash shell-script

0
推荐指数
2
解决办法
2824
查看次数

标签 统计

shell-script ×2

bash ×1

cron ×1

cups ×1

ghostscript ×1

pdf ×1

printing ×1

sed ×1