0

I'm facing an issue on executing a cronjob.Below is the snippet of the code.

 containers:
      - name: ssm1db
        image: anuragh/ubuntu:mycronjob5
        imagePullPolicy: Always
       command:
         - "/bin/sh"
         - "-c"
         - "kubectl exec ssm1db-0 -- bash -c 'whoami; /db2/db2inst1/dba/jobs/dbactivate.sh -d wdp'"

For example. I'm able to execute the below code .Here db2inst1 is the user which i need the script to be executed.

/bin/su -c ./full_online_backup.sh - db2inst1

But while executing using kubectl ,getting below error

/bin/su: /bin/su: cannot execute binary file
command terminated with exit code 126
[root@ssm1db-0 /]# 
Anuradha Fernando
  • 1,063
  • 12
  • 17
  • Could someone please help me on this – Anuragh Ravindran Jan 14 '20 at 06:14
  • If a command is found but is not executable, the return status is 126. [Refer](https://www.gnu.org/software/bash/manual/html_node/Exit-Status.html) .. So does your user have execute permissions for what you are trying ? – DT. Jan 14 '20 at 08:38
  • @AnuraghRavindran what is the exact command you wanna run with the cronjob. And the other thing I see in here is, you are using relative paths like ./full_online... can you try with absolute paths? – Anuradha Fernando Jan 14 '20 at 08:49
  • @Anuragh Ravindran Could you please provide the answers to above questions? – Wytrzymały Wiktor Jan 16 '20 at 10:51

1 Answers1

0

Related question : How to start crond as non-root user in a Docker Container?

You would encounter permission issues when running crond in a non root user.

japzio
  • 11
  • 4