0

Thanks in adviance:

Hello im trying to execute diferent commands extracted from other stable script used to extract the commands we have to execute in cyradm console i do

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

this generates a script .sh that i cant never execute in the cyradm console (ever fails) not find the command i tried many things but i started to think is impossible doing with simple shell or bash scripts

example:

 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

when i put only the command works

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 IS SHELL (OR THAT SEEMS)

localhost> echo $BASH
/bin/sh

AND IM ROOT

localhost> whoami
root

the script has the proper rights (i edited some text changing personal info by xxxxxx) anyone knows how to execute external scripts in cyradm console?? , i tried many thing , but nothing worked for me ..

1 Answers1

0
#!/bin/bash
echo "Need IMAP password , please input password"
{
cyradm --user mailadmin localhost << EOT
cm
sam
EOT
} >> error.out
  • Hi and welcome to stackoverflow, and thank you for answering. While this code might answer the question, can you consider adding some explanation for what the problem was you solved, and how you solved it? This will help future readers to understand your answer better and learn from it. – Plutian Feb 21 '20 at 12:40
  • The cyradm is a bit weird... first try to execute as perl, and if not find then tries with bash , the problem was i cannot pass any commands to this console ... this was the only way to make commands be executed on this console . – Unix - David Ezcurra Mar 04 '20 at 13:58