OpenSDE Packages Database (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

65 lines
1.7 KiB

  1. #!/bin/bash
  2. #
  3. # --- T2-COPYRIGHT-NOTE-BEGIN ---
  4. # This copyright note is auto-generated by ./scripts/Create-CopyPatch.
  5. #
  6. # T2 SDE: package/.../oprofile/pulpstoned.sh
  7. # Copyright (C) 2004 - 2006 The T2 SDE Project
  8. # Copyright (C) 1998 - 2003 Clifford Wolf
  9. #
  10. # More information can be found in the files COPYING and README.
  11. #
  12. # This program is free software; you can redistribute it and/or modify
  13. # it under the terms of the GNU General Public License as published by
  14. # the Free Software Foundation; version 2 of the License. A copy of the
  15. # GNU General Public License can be found in the file COPYING.
  16. # --- T2-COPYRIGHT-NOTE-END ---
  17. period=600
  18. report_script=pulpstoner
  19. report_dir=/var/log/pulpstone
  20. pidfile=/var/run/pulpstoned.pid
  21. cd /; mkdir -p $report_dir
  22. echo "pulpstone daemon: writing logs to $report_dir ..."
  23. (
  24. psd_end() {
  25. opcontrol -h
  26. echo "Shutting down on signal."
  27. rm -f $pidfile
  28. date +"=== <%Y/%m/%d %H:%M:%S> ==="
  29. exit 0
  30. }
  31. trap psd_end INT TERM
  32. echo $$ > $pidfile
  33. while true; do
  34. now=`date +"%Y%m%d%H"`
  35. exec >> $report_dir/$now.log 2>&1
  36. for x in $report_dir/*.log; do
  37. [ "$x" = "$report_dir/$now.log" ] && continue
  38. echo; echo "Uploading $report_dir/$now.log ..."
  39. res="$( curl -s -F data=@$x http://www.rocklinux.net/pulpstone/upload.cgi )"
  40. if [ "$res" = "ok" ]; then
  41. echo "File upload succesfull."
  42. mv $x ${x%.log}.old
  43. else
  44. echo "Error while uploading."
  45. fi
  46. done
  47. date +"%n=== <%Y/%m/%d %H:%M:%S> ==="
  48. opcontrol -s
  49. opcontrol --reset
  50. opcontrol --event="CPU_CLK_UNHALTED:100000:0:1:1"
  51. for ((c=0; c<period; c++)); do sleep 1; done
  52. opcontrol -h
  53. date +"=== <%Y/%m/%d %H:%M:%S> ==="
  54. nice -n 99 $report_script | unexpand -a
  55. date +"=== <%Y/%m/%d %H:%M:%S> ==="
  56. done
  57. ) &