Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #=========================================#
- # /etc/update-motd.d/50-landscape-sysinfo #
- #=========================================#
- #!/bin/sh
- cores=$(grep -c ^processor /proc/cpuinfo 2>/dev/null)
- [ "$cores" -eq "0" ] && cores=1
- threshold="${cores:-1}.0"
- if [ $(echo "`cut -f1 -d ' ' /proc/loadavg` < $threshold" | bc) -eq 1 ]; then
- echo
- echo -n " System information as of "
- /bin/date
- echo
- /usr/bin/landscape-sysinfo
- else
- echo
- echo " System information disabled due to load higher than $threshold"
- fi
- #============================#
- # /usr/bin/landscape-sysinfo #
- #============================#
- #! /usr/bin/python
- import sys, os
- try:
- if os.path.dirname(os.path.abspath(sys.argv[0])) == os.path.abspath("scripts"):
- sys.path.insert(0, "./")
- else:
- from landscape.lib.warning import hide_warnings
- hide_warnings()
- from twisted.internet import reactor
- from landscape.sysinfo.deployment import run
- except ImportError:
- # For some reasons the libraries are not importable for now. We are
- # probably during an upgrade procedure, so let's exit, expecting the
- # dependencies to be fixed at next run.
- sys.exit(2)
- if __name__ == "__main__":
- run(sys.argv[1:], reactor)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement