Since I can’t determine when the tasks on the server will finish, and it’s impossible to constantly monitor the server to check whether the tasks are completed, I need a way to notify me when task is finished.
In the end, I use a solution which is combined by Bash and yagmail.
Simply put, I write a Python file to send email to me, then, execute this Python file at the end of the Bash script that runs the task.