每次执行特定的cronjob时,我都会收到以下邮件.当我直接调用它时,调用的脚本运行正常,甚至来自cron.所以我得到的消息不是一个实际的错误,因为脚本完全按照它应该做的去做.
这是cron.d条目:
* * * * * root /bin/bash -l -c "/opt/get.sh > /tmp/file"
Run Code Online (Sandbox Code Playgroud)
和get.sh脚本本身:
#!/bin/sh
#group and url
groups="foo"
url="https://somehost.test/get.php?groups=${groups}"
# encryption
pass='bar'
method='aes-256-xts'
pass=$(echo -n $pass | xxd -ps | sed 's/[[:xdigit:]]\{2\}/&/g')
encrypted=$(wget -qO- ${url})
decoded=$(echo -n $encrypted | awk -F '#' '{print $1}')
iv=$(echo $encrypted | awk -F '#' '{print $2}' |base64 --decode | xxd -ps | sed 's/[[:xdigit:]]\{2\}/&/g')
# base64 decode input and save to file
output=$(echo -n $decoded | base64 --decode | openssl enc -${method} …Run Code Online (Sandbox Code Playgroud)