#!/bin/bash if [ -e "/tmp/something.run" ]; then echo "Another instance of the script is running. Aborting." exit fi touch "/tmp/something.run" ###################### # 這邊放要執行的命令 rm "/tmp/something.run"