GAWK 未在 crontab 中运行

GAWK 未在 crontab 中运行

我手动成功运行了下面的脚本。但是当它在 crontab 中执行时(见下文),我没有看到任何反应。

脚本

#!/usr/bin/gawk -f
#!/bin/bash

PATH=/usr/local/bin:/usr/bin

#Reading from the file & storing in array
array=()
while read -r line; do
array+=($line)
done < /etc/folder/automation-script/ip.txt

#Removing the lines based on line number of file

gawk -i inplace 'NR==30 {next} {print}' /etc/folder/default.vcl
gawk -i inplace 'NR==38 {next} {print}' /etc/folder/default.vcl

#Adding lines based on line number of VCL file

gawk  -i inplace -v line1=${array[0]} 'NR==30{print ".host = ""\042"line1"\042"";"}1' /etc/folder/default.vcl
gawk -i inplace -v line2=${array[1]} 'NR==39{print ".host = ""\042"line2"\042"";"}1' /etc/folder/default.vcl

定时任务

35 04 16 11 * /etc/folder/automation-script/autoscript.sh

相关内容