Articles in this section

Quick project inventory of your Upsun projects

Goal

To quickly iterate through all your Upsun projects and check if they still receive traffic.

 

Assumptions

You will need:

  • An SSH key configured on your Upsun account
  • The Upsun CLI installed

     

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 ""
done

Other

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.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.