Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.57 KB | None | 0 0
  1. #/bin/bash
  2.  
  3. while sleep 1; do
  4. # get process id for ipfs daemon
  5. output=`ps aux | grep "ipfs daemon" | grep -v grep`
  6. set -- $output
  7. pid=$2
  8. # get timestamp
  9. timestamp=$(date +%s)
  10. # get process memory usage in kilobytes
  11. res_mem=`ps -p $pid -o rss | tail -1`
  12. # get ipfs repo size in bytes
  13. output=`ipfs repo stat | grep RepoSize`
  14. set -- $output
  15. repo_size=$2
  16. # get ipfs peer count
  17. peer_count=`ipfs swarm peers | wc -l`
  18. # write to log file
  19. echo "$timestamp $res_mem $repo_size $peer_count"
  20. echo "$timestamp $res_mem $repo_size $peer_count" >> ipfs_log
  21. done
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement