Ensure our operating system is entirely up to date:
sudo apt-get update
sudo apt-get upgrade| #!/bin/bash | |
| cd /mnt/user/appdata/NginxProxyManager/nginx | |
| echo "IPV4" >> new.conf | |
| echo "" >> new.conf | |
| curl -sSL https://www.cloudflare.com/ips-v4 | awk '{print "allow",$1,";"}' >> new.conf | |
| echo "IPV6" >> new.conf | |
| echo "" >> new.conf | |
| curl -sSL https://www.cloudflare.com/ips-v6 | awk '{print "allow",$1,";"}' >> new.conf |
This mainly demonstrates my goal of preparing a Raspberry Pi to be provisioned prior to its first boot. To do this I have chosen to use the same cloud-init that is the standard for provisioning servers at Amazon EC2, Microsoft Azure, OpenStack, etc.
I found this to be quite challenging because there is little information available for using cloud-init without a cloud. So, this project also servers as a demonstration for anyone on any version of Linux who may want to install from source, and/or use without a cloud. If you fall into that later group, you probably just want to read the code. It's bash so everything I do, you could also do at the command line. (Even the for loop.)
| import asyncio | |
| loop = asyncio.get_event_loop() | |
| async def hello(): | |
| await asyncio.sleep(3) | |
| print('Hello!') | |
| if __name__ == '__main__': | |
| loop.run_until_complete(hello()) | |
dash_sniffer.service/lib/systemd/system/systemd using command: systemctl daemon-reloadsystemctl enable dash_sniffer.service