简体   繁体   中英

bash script not doing as a cron, but manually

The script itself is working well, when executed manually. It fails a cron job

function ban_this {
while IFS= read -r line
do
printf $line >> /tmp/test.file
done < <(printf '%s\n' "$a") 
}

a=$(journalctl | grep "client @")
ban_this
function ban_this {
printf %s "$a" |
while IFS= read -r line; do
echo "$line"
done
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM