ShellBanner
System:Linux MiraNet 3.0.0-14-generic-pae #23-Ubuntu SMP Mon Nov 21 22:07:10 UTC 2011 i686
Software:Apache. PHP/5.3.6-13ubuntu3.10
ID:uid=65534(nobody) gid=65534(nogroup) groups=65534(nogroup)
Safe Mode:OFF
Open_Basedir:OFF
Freespace:22.78 GB of 70.42 GB (32.36%)
MySQL: ON MSSQL: OFF Oracle: OFF PostgreSQL: OFF Curl: OFF Sockets: ON Fetch: OFF Wget: ON Perl: ON
Disabled Functions: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,

/ usr/ share/ pyshared/ landscape/ monitor/ - drwxr-xr-x

Directory:
Viewing file:     rebootrequired.py (2.23 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import os
import logging

from landscape.lib.fs import read_file
from landscape.monitor.plugin import MonitorPlugin


class RebootRequired(MonitorPlugin):
    """
    Report whether the system requires a reboot.

    @param reboot_required_filename: The path to the flag file that indicates
        if the system needs to be rebooted.
    """

    persist_name = "reboot-required"
    run_interval = 900  # 15 minutes
    run_immediately = True

    def __init__(self, reboot_required_filename="/var/run/reboot-required"):
        self._flag_filename = reboot_required_filename
        self._packages_filename = reboot_required_filename + ".pkgs"

    def _get_flag(self):
        """Return a boolean indicating whether the computer needs a reboot."""
        return os.path.exists(self._flag_filename)

    def _get_packages(self):
        """Return the list of packages that required a reboot, if any."""
        if not os.path.exists(self._packages_filename):
            return []

        lines = read_file(self._packages_filename).splitlines()
        packages = set(line.strip().decode("utf-8") for line in lines if line)
        return sorted(packages)

    def _create_message(self):
        """Return the body of the reboot-required message to be sent."""
        message = {}
        flag = self._get_flag()
        packages = self._get_packages()
        for key, value in [("flag", flag), ("packages", packages)]:
            if value == self._persist.get(key):
                continue
            self._persist.set(key, value)
            message[key] = value
        return message

    def send_message(self):
        """Send a reboot-required message if needed.

        A message will be sent only if the reboot-required status of the
        system has changed.
        """
        message = self._create_message()
        if message:
            message["type"] = "reboot-required-info"
            logging.info("Queueing message with updated "
                         "reboot-required status.")
            self.registry.broker.send_message(message, urgent=True)

    def run(self):
        """Send reboot-required messages if the server accepts them."""
        return self.registry.broker.call_if_accepted(
            "reboot-required-info", self.send_message)
Command:
Quick Commands:
Upload:
[Read-Only] Max size: 100MB
PHP Filesystem: <@ Ú
Search File:
regexp
Create File:
Overwrite [Read-Only]
View File:
Mass Defacement:
[+] Main Directory: [+] Defacement Url:
LmfaoX Shell - Private Build [BETA] - v0.1 -; Generated: 0.2345 seconds