There’re some general ideas in all scripts, so let’s overview ’em:
1. Add comments to every important action:
2. Use variables instead of hardcoding:
3. If you need small files with variables from main script, create ’em from the main script:
4. Use functions to make the script structured:
5. Use the same structure for simple and complex functions:
6. Measure functions execution time:
7. If function fails, stop errors spread:
8. Use main log to store important results:
… and use temporary log for small checks:
9. Send important logs to email:
10. Delete old stuff instead of replacement:
11. Test every important step:
12. Give it some time to start before checking:
13. Don’t forget to check twice:
14. Don’t give up – force it:
15. Cleanup after yourself: