system-administration

Python App ouput to syslog server

北慕城南 提交于 2021-02-07 06:56:48
问题 I'm trying to do some searching on google (looped for every 5 min or so). When it gets a hit I want it to push the results to a syslog server. I'm very new to python so please forgive the ignorance, I have searched for ages and can't find an answer to my question. I intend to add multiple queries looking for diffirent results depending on the query results the logevent differs. WARN "possible hit" CRITICAL "definatly a hit" etc I would like the output to be for example like: log type, url,

How to force delete an open file using PowerShell

﹥>﹥吖頭↗ 提交于 2021-01-27 07:05:28
问题 Remove-Item command does not delete files which are in use. Is there any way where we can delete all the files irrespective of their state? 回答1: You can do this is by finding the processes that are using the file then stop the processess.You can then delete the file after. $allProcesses = Get-Process #$lockedFile is the file path foreach ($process in $allProcesses) { $process.Modules | where {$_.FileName -eq $lockedFile} | Stop-Process -Force -ErrorAction SilentlyContinue } Remove-Item

Netbeans C/C++ 7.2 -std=C++11 not recognized by gcc v4.6 or lower

北战南征 提交于 2020-01-10 05:34:05
问题 I left Eclipse to NetBeans for C/C++ development right after release v7 and it all seems a wise choice except that -std=C++11 flag in the current latest release, namely 7.2, is not recognized by gcc 4.6 ( -std=C++0x ) or the previous. Since Ubuntu 12.04 ships with gcc 4.6 (which should be fair enough to use for my jobs in term of 11 features) and a fresh installation of gcc 4.7 might bring about complexity in maintenance of the system (well...I'm a person extremely simple, neat and clean), is

How to recover a dropped database on MySQL

萝らか妹 提交于 2020-01-06 05:39:08
问题 I accidentaly dropped a database on MySQL yog ultimate. Also, I found that the IT guy uninstalled MySQL yog from the machine. Now am working on two machines which includes the one from which database was dropped and mysql was uninstalled. Is there a way to recover the dropped databases. 回答1: You said in a comment that you have a backup from a couple of hours prior to the data loss. If you also have binary logs, you can restore the backup, and then reapply changes from the binary logs. Here is

DNS checking using perl and Net::DNS

旧时模样 提交于 2020-01-04 03:45:20
问题 So, in the otter book, there is a small script(see page 173) whose purpose is to iteratively check DNS servers to see if they are returning the same address for a given hostname. However, the solution given in the book works only when the host has a static IP address. How would I write this script if I wanted it to work with hosts that have multiple addresses associated with them? Here is the code: #!/usr/bin/perl use Data::Dumper; use Net::DNS; my $hostname = $ARGV[0]; # servers to check my

How to create System Apps in android

假装没事ソ 提交于 2019-12-30 00:53:13
问题 I want to create an system application(while installing it will ask user permission to make it as system app) for UN-rooted application. As I am not familiar in android, please tell me how to create it. Thanks in advance. 回答1: True system apps are baked into the ROM image, and signed with the same key the ROM was signed with, giving them extra access to the system. You cannot add a new system app on the same level without updating the ROM image of the device, and even then you'll need the OEM

My php script is killed automatically by the OS (DEBIAN)

拜拜、爱过 提交于 2019-12-25 05:00:30
问题 I have a php script that is killed after 10 minutes by the OS (debian) I don't want it to be killed Someone told me that my server maybe has a task monitor that kills long-running processes as a safeguard against lockups. I don't know how to access to the task monitor and how to disable it 回答1: What Apache error log says? If you have error: Fatal error: Maximum execution time of ... then you have to turn off limit for PHP script execution time, which can be set like this: set_time_limit(0); /

Exception calling “GetHostEntry” with “1” argument(s): “No such device or address”

大城市里の小女人 提交于 2019-12-24 19:38:01
问题 The FQDN for this machine: thufir@dur:~$ thufir@dur:~$ hostname --fqdn dur.bounceme.net thufir@dur:~$ Yes...working directly with powershell gives the FQDN of dur.bounceme.net okay: thufir@dur:~/powershell$ thufir@dur:~/powershell$ pwsh PowerShell v6.0.1 Copyright (c) Microsoft Corporation. All rights reserved. https://aka.ms/pscore6-docs Type 'help' to get help. PS /home/thufir/powershell> PS /home/thufir/powershell> [System.Net.Dns]::GetHostByName((hostname)).HostName dur.bounceme.net PS

How do you uninstall the package manager “pip”, if installed from source?

穿精又带淫゛_ 提交于 2019-12-20 11:14:33
问题 I was unaware that pip could be installed via my operating system's package manager, so I compiled and installed pip via source with the following command: wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py -O - | sudo python I would like to uninstall pip, and instead install it from my operating system's package manager. How would I go about completely undoing the work of the installation script? 回答1: That way you haven't installed pip, you installed just the easy_install i

How do I extract the contents of an rpm?

这一生的挚爱 提交于 2019-12-17 22:05:11
问题 I have an rpm and I want to treat it like a tarball. I want to extract the contents into a directory so I can inspect the contents. I am familiar with the querying commands of an uninstalled package. I do not simply want a list of the contents of the rpm. i.e. $ rpm -qpl foo.rpm I want to inspect the contents of several files contained in the rpm. I do not want to install the rpm. I am also aware of the rpms ability to do additional modifictions in the %post sections, and how to check for