How to run cronjob in azure cloud bash shell

647 Views Asked by At

I'm trying to run cron job in azure cloud shell but it is not working

This is my simple cron job

* * * * *  /home/meet/clouddrive/temp.sh

where

cat /home/meet/clouddrive/temp.sh
#!/bin/bash
echo "meet" >> /home/meet/clouddrive/test.txt
pwd
/home/meet/clouddrive
meet [ ~/clouddrive ]$ ls
temp.sh
1

There are 1 best solutions below

0
Imran On

I tried to reproduce the same in my environment and got the results like below:

I tried to run Cron job in azure cloud shell like below:

when I try crontab -l there is no job from here.

enter image description here

Then create crontab -e

Run */1 * * * * echo "this is a test" /home/imran123/testfile.txt

Then try to create a file using vi testfile.txt and I mention "This is test"

Then try to give execute permission like below:

chmod +x test.sh

enter image description here

Then when I executed cmd it run successfully like below:

crontab -l
cat testfile.txt

enter image description here