We had a task to Create a docker file with ubuntu image Create a print.sh file which has code to print date and time Write a cron file named "hello-cron" which includes the print.sh to run for every 1 min. The docker image should have a CRON job to print date and time every 1 min We created a print.sh file via vi command and in it given as #!/bin/sh -l time=$(date) echo "::set-output name=time::$time" After which we had executed - chmod +x print.sh then tried as - * * * * * /home/scrapbook/tutorial Not sure where we went wrong, please guide us.
You do not say in what way is which command not working. https://www.howtoforge.com/communit...or-a-first-time-linux-user.83782/#post-399369
Hi, I had successfully created print.sh but cannot able to run a cron file with print.sh with a min. Need help for it.
I am assuming you are using Ubuntu 20.04. Put listings and command outputs you post in CODE tags. See https://www.howtoforge.com/community/threads/please-read-before-posting.58408/ What shows command Code: crontab -l What shows command Code: ls -lh print.sh Put your print.sh file in /tmp directory for testing. Then use command Code: crontab -e to add line Code: * * * * * /tmp/print.sh Do note that unless you have set up cron to e-mail the results to you, your print.sh does nothing visible. I would modify print.sh with adding line Code: echo $(date) >> /tmp/foobar.txt and then see what happens with command Code: tail -f /tmp/foobar.txt
We execute above command - $ $ crontab -l no crontab for root $ ls $ pwd /home/scrapbook/tutorial $ We need to perform - Create a docker file with ubuntu image Create a print.sh file which has code to print date and time Write a cron file named "hello-cron" which includes the print.sh to run for every 1 min The docker image should have a CRON job to print date and time every 1 min
I've never used docker, but the command in a crontab should be executable, where it seems you put a directory path.
Do you have the docker file with ubuntu image created? Does it work? If yes, do the commands I gave in #4 work?
Do you have the docker file with ubuntu image created? Does it work? If yes, do the commands I gave in #4 work? Does not worked ... We need to perform - Create a docker file with ubuntu image Create a print.sh file which has code to print date and time Write a cron file named "hello-cron" which includes the print.sh to run for every 1 min The docker image should have a CRON job to print date and time every 1 min
When I use Internet Search Engines with Code: Create a docker file with ubuntu image the first item it finds is https://www.howtoforge.com/tutorial/how-to-create-docker-images-with-dockerfile/