Créer un cron en bash et insérer une commande curl
Bonjour à tous,
Pourriez vous m'aider s'il vous plaît?
Je souhaite créer un cron en bash qui execute une commande curl vers une api, cela va appeler une api, comment insérer la commande curl dans le cron?
Ce bash va tourner sous un docker voilà pour j'installe cron avant
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
#!/usr/bin/env bash
sudo apt update
sudo apt install cron
curl -H "Content-type: application/json" -d '{
"password": "r3PMx^h25U-UWRSJ!UyD"
}' '127.0.0.1/api/cron/notifications/comments_activities_client'
#write out current crontab
crontab -l > mycron
#echo new cron into cron file
echo "0 */1 * * *" >> mycron
#install new cron file
crontab mycron
rm mycron |
Merci