Guest karthi Posted April 7, 2023 Posted April 7, 2023 To schedule a cronjob on azure app service Linux web application you can follow the steps outlined below, Navigate to “SSH” from azure app services portal and click on Go -> Create a script file in /home with name as start.sh and add the below lines to the script file and save the file. Command to create a script file - touch /home/start.sh Open the file using vim editor: vi /home/start.sh and copy the below code # Installing cron apt-get update -qq && apt-get install cron -yqq # Starting cron service cron start #cron scheduler (crontab -l 2>/dev/null; echo "* * * * * find /home/BackupLogs -type f -size 1k -delete ")|crontab Post that, you can add the created script as a startup command which would install the cron, start the cron and schedule the cron during startup. To add as a startup command, navigate to Azure portal -> Configuration blade -> General settings tab and provide as below, In the above sample code, it checks for all the files with size 1KB in /home/BackupLogs and delete them for every minute. Based on your convenience you can adjust the CRON scheduler time and command Continue reading... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.