Guest User

Untitled

a guest
Nov 2nd, 2017
430
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. #!/bin/sh
  2.  
  3. ###### Check for badly named files next #######
  4.  
  5. # Possible names for Clickstream Report
  6. for clickstream in "./Digital Content Clickstream Data" "./Digital Content Clickstream Data Report" "./Digital Content Clickstream Report"
  7. do
  8. if [ -f "$clickstream.xls" ] ; then
  9. echo "$clickstream.xls is an Excel file. Please convert to CSV first"
  10. fi
  11. if [ -f "$clickstream.xlsx" ] ; then
  12. echo "$clickstream.xlsx is an Excel file. Please convert to CSV first"
  13. fi
  14. if [ -f "$clickstream.csv" ] ; then
  15. mv "$clickstream.csv" callstreamImport.csv
  16. fi
  17. done
  18.  
  19. # Possible names for Key Message Report
  20. for key in "./NBU Call Key Message Data" "./NBU Call Key Message data" "./NBU Call Key Message" "./NBU Call Key Message Report" "./NBU Call Key Message report"
  21. do
  22. if [ -f "$key.xls" ] ; then
  23. echo "$key.xls is an Excel file. Please convert to CSV first"
  24. fi
  25. if [ -f "$key.xlsx" ] ; then
  26. echo "$key.xlsx is an Excel file. Please convert to CSV first"
  27. fi
  28. if [ -f "$key.csv" ] ; then
  29. mv "$key.csv" keymessageImport.csv
  30. fi
  31. done
  32.  
  33. # Possible names for Approved Email Report
  34. for email in "./Approved Email report for NBU and GI" "./Approved Email report for GI and NBU" "./Approved Email report for GI and NBU Report"
  35. do
  36. if [ -f "$email.xls" ] ; then
  37. echo "$email.xls is an Excel file. Please convert to CSV first"
  38. fi
  39. if [ -f "$email.xlsx" ] ; then
  40. echo "$email.xlsx is an Excel file. Please convert to CSV first"
  41. fi
  42. if [ -f "$email.csv" ] ; then
  43. mv "$email.csv" approvedemailImport.csv
  44. fi
  45. done
  46.  
  47.  
  48. ###### Clean, then send the files to the server and run the import scripts #######
  49.  
  50. if [ -f "./callstreamImport.csv" ] ; then
  51. sed -i '/^,/Q' callstreamImport.csv # trim trash footer
  52. scp callstreamImport.csv tomasino@dev.gsw-w.com:/var/www/dev.gsw-w.com/automation/callstreamImport.csv
  53. ssh tomasino@dev.gsw-w.com /var/www/dev.gsw-w.com/automation/callstreamImport.sh
  54. fi
  55.  
  56. if [ -f "./keymessageImport.csv" ] ; then
  57. sed -i '/^,/Q' keymessageImport.csv # trim trash footer
  58. scp keymessageImport.csv tomasino@dev.gsw-w.com:/var/www/dev.gsw-w.com/automation/keymessageImport.csv
  59. ssh tomasino@dev.gsw-w.com /var/www/dev.gsw-w.com/automation/keymessageImport.sh
  60. fi
  61.  
  62. if [ -f "./approvedemailImport.csv" ] ; then
  63. sed -i '/^,/Q' approvedemailImport.csv # trim trash footer
  64. scp approvedemailImport.csv tomasino@dev.gsw-w.com:/var/www/dev.gsw-w.com/automation/approvedemailImport.csv
  65. ssh tomasino@dev.gsw-w.com /var/www/dev.gsw-w.com/automation/approvedemailImport.sh
  66. fi
Add Comment
Please, Sign In to add comment