If you want to run a script every 11 months, here’s the crontab entry.
* * 1 */11 * /bin/bash /path/to/script.sh |
cloud engineer
If you want to run a script every 11 months, here’s the crontab entry.
* * 1 */11 * /bin/bash /path/to/script.sh |
* * 1 */11 * /bin/bash /path/to/script.sh
How to add bash scripts on startup.
update-rc.d
sudo cp /path/to/yourscript.sh /etc/init.d/yourscript.sh sudo update-rc.d /etc/init.d/yourscript.sh defaults chmod +x /etc/init.d/yourscript.sh |
sudo cp /path/to/yourscript.sh /etc/init.d/yourscript.sh sudo update-rc.d /etc/init.d/yourscript.sh defaults chmod +x /etc/init.d/yourscript.sh
Root Crontab
sudo crontab -e @reboot /path/to/yourscript.sh |
sudo crontab -e @reboot /path/to/yourscript.sh
How to display IP address and Instance ID on web page behind a AWS load balancer.
Add these 2 commands in crontab. The job runs every 5 mins.
*/5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/instance-id > /var/www/html/id.txt */5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/public-ipv4 > /var/www/html/ip.txt |
*/5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/instance-id > /var/www/html/id.txt */5 * * * * /usr/bin/curl http://169.254.169.254/latest/meta-data/public-ipv4 > /var/www/html/ip.txt
You can view on the site.
# your domain http://yourdomain.com/ip.txt http://yourdomain.com/id.txt # your server ip address http://1.1.1.1/ip.txt http://1.1.1.1/id.txt |
# your domain http://yourdomain.com/ip.txt http://yourdomain.com/id.txt # your server ip address http://1.1.1.1/ip.txt http://1.1.1.1/id.txt