Goal
To quickly iterate through all your Upsun projects and check if they still receive traffic.
Assumptions
You will need:
Problems it solves
If you manage a lot of Upsun projects, this simple shell command will iterate through all of them and list the last lines of the project’s access log, allowing you to easily check if they still receive traffic.
Steps
Copy the script
Copy the script below into a project_check.sh file on your Linux (or Windows Subsystem for Linux) local computer and run it.
for i in `upsun p:list --format csv | grep -v ID | awk '{split($0,a,","); print a[1];}' `;
do
echo "=== Project $i ==="
prod_env=`upsun e:list -p $i --format csv | grep production | awk '{split($0,a,","); print a[1];}'`
echo "--- Logs of production environment $prod_env ---"
upsun log -p $i -e $prod_env access | tail -5
echo ""
doneOther
You can adjust the “-5” parameter to a higher value (like -10, -50 to display more log lines). If you have any ideas to improve the script, please reply to this topic.
Comments
Please sign in to leave a comment.