0

提前致谢:

您好,我正在尝试执行从其他稳定脚本中提取的不同命令,这些稳定脚本用于提取我们必须在 cyradm 控制台中执行的命令

[root@srvmtrx9870]# sh addFolder2Mailbox.sh > commands.sh

这会生成一个脚本 .sh,我永远无法在 cyradm 控制台中执行(永远失败)找不到命令我尝试了很多东西,但我开始认为使用简单的 shell 或 bash 脚本是不可能的

例子:

 localhost>  ./commands.sh
    ./commands.sh: línea 1: cm: no se encontró la orden
    ./commands.sh: línea 2: sam: no se encontró la orden
    ./commands.sh: línea 3: cm: no se encontró la orden
    ./commands.sh: línea 4: sam: no se encontró la orden
    ./commands.sh: línea 5: cm: no se encontró la orden
    ./commands.sh: línea 6: sam: no se encontró la orden
    ./commands.sh: línea 7: quit: no se encontró la orden

当我只输入命令时

localhost> cm
usage: createmailbox [--partition partition] mailbox [partition]
cat commands.sh
cm 'user/'
sam 'user/'  lrswipcda
cm 'user/xxxxxxxxxxxxxxxxxxxxxxx'
sam 'user/xxxxxxxxxxxxxxxxxxxxxxx'  lrswipcda
cm 'user/xxxxxxxxx/xxxxxxxxxxxxxxxxxxxx'
sam 'user/xxxxxxxx/xxxxxxxxxxxxxxxxxxxx'  lrswipcda
quit

BASH 是外壳(或看起来)

localhost> echo $BASH
/bin/sh

我是根

localhost> whoami
root

该脚本具有适当的权限(我编辑了一些由 xxxxxx 更改个人信息的文本)有人知道如何在 cyradm 控制台中执行外部脚本吗?,我尝试了很多东西,但没有什么对我有用..

4

1 回答 1

0
#!/bin/bash
echo "Need IMAP password , please input password"
{
cyradm --user mailadmin localhost << EOT
cm
sam
EOT
} >> error.out
于 2020-02-21T08:33:05.647 回答