There are no shortcuts with this. Linux is so powerful because it lets you do anything, including stupid things like removing everything.
You are lucky as you have backups. The next task is to install a fresh server and recover the data from your backups. While it would be possible to try and recover some data using data recovery software, the data on the backups has way better integrity. However, if you might need some data from the old installation anyway, you should not reuse the same disk, but buy a new one.
This will affect your business, so wise communication with your customers is crucial. Do not try and cover up anything. Be honest that there will be some downtime due to human error, and tell that they should not worry, because you had backups. Naturally it would have been better if they were from the last night, instead. After the incident you can revise your backup plans.
Also, when writing scripts, always validate the variables before passing them to rm -rf
. There could also have been other errors with your $path
causing the same outcome, e.g. rm -rf /some/directory /*
, if the variable had a tailing space.