Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
980 views
in Technique[技术] by (71.8m points)

cron - How to write a cronjob in amazon linux

I have an EC2 instance and I have the following bash script which I need to run;

  1. Every 1 minute
  2. The same script every 12 hours
TOKEN=$(aws ecr get-login-password --region us-east-2)
# echo $TOKEN

CONVERT_ME="AWS:${TOKEN}"

BASE_64_ENCODED=$(echo -n "${CONVERT_ME}" | base64)

echo $BASE_64_ENCODED

jq -n --arg TOKEN $TOKEN '{"HttpHeaders": {"User-Agent": "Docker-Client/19.03.13-ce (linux)"},"auths": {"337198119645.dkr.ecr.us-east-2.amazonaws.com": {"auth": $TOKEN}}}' > ~/.docker/config.json

If I do something like below, it says command not found

* * * * * update.sh

So I tried crontab -e and put the above command, how can I make sure if it is executing? is there a timer we can track? or am I doing this all wrong?

Thank you

question from:https://stackoverflow.com/questions/65860789/how-to-write-a-cronjob-in-amazon-linux

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...